Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Conexión con bases de datos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Conexión con bases de datos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 11-10-2006
aladelta aladelta is offline
Miembro
 
Registrado: jul 2003
Posts: 70
Poder: 21
aladelta Va por buen camino
Question Firebird e IBOConsole

Hola a todos

Pues resulta que inventigando como Sherlock en mi nueva campaña para saber mas sobre este motor, resulta que con el adminsitrador IBOConsole, no se como demonios puedo crear un Generate para campos autoincrementales, porque el Trigger ya lo se y veo donde, pero el Generate no intuyo donde puedo escribirlo..me imagino que sera dentro de cada campo en cada tabla pero no veo el sitio...

Alguien que lo sepa y ayude por favor...

Gracias...
Responder Con Cita
  #2  
Antiguo 12-10-2006
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Poder: 29
Lepe Va por buen camino
el langref.pdf de interbase lo explica mejor que yop:

directamente, como si crearas una tabla.
Cita:
CREATE GENERATOR
Declares a generator to the database. Available in SQL, DSQL, and isql.
Syntax CREATE GENERATOR name;
IMPORTANT In SQL statements passed to DSQL, omit the terminating semicolon. In embedded
applications written in C and C++, and in isql, the semicolon is a terminating symbol for
the statement, so it must be included.
Description CREATE GENERATOR declares a generator to the database and sets its starting value to
zero. A generator is a sequential number that can be automatically inserted in a column
with the GEN_ID() function. A generator is often used to ensure a unique value in a
PRIMARY KEY, such as an invoice number, that must uniquely identify the associated row.
A database can contain any number of generators. Generators are global to the database,
and can be used and updated in any transaction. InterBase does not assign duplicate
generator values across transactions.
You can use SET GENERATOR to set or change the value of an existing generator when
writing triggers, procedures, or SQL statements that call GEN_ID().
Note There is no “drop generator” statement. To remove a generator, delete it from the
system table. For example:
DELETE FROM RDB$GENERATOR WHERE RDB$GENERATOR_NAME = ‘EMPNO_GEN’;
Example The following isql script fragment creates the generator, EMPNO_GEN, and the trigger,
CREATE_EMPNO. The trigger uses the generator to produce sequential numeric keys,
incremented by 1, for the NEW.EMPNO column:
CREATE GENERATOR EMPNO_GEN;
COMMIT;
Argument Description
name Name for the generator
CREATE INDEX
LANGUAGE REFERENCE 59
SET TERM !! ;
CREATE TRIGGER CREATE_EMPNO FOR EMPLOYEES
BEFORE INSERT POSITION 0
AS BEGIN
NEW.EMPNO = GEN_ID(EMPNO_GEN, 1);
END
SET TERM ; !!
IMPORTANT Because each statement in a stored procedure body must be terminated by a semicolon,
you must define a different symbol to terminate the CREATE TRIGGER in isql. Use SET TERM
before CREATE TRIGGER to specify a terminator other than a semicolon. After CREATE
TRIGGER, include another SET TERM to change the terminator back to a semicolon.
Cita:
SET GENERATOR
Sets a new value for an existing generator. Available in SQL, DSQL, and isql.
Syntax SET GENERATOR name TO int;
IMPORTANT In SQL statements passed to DSQL, omit the terminating semicolon. In embedded
applications written in C and C++, and in isql, the semicolon is a terminating symbol for
the statement, so it must be included.
Description SET GENERATOR initializes a starting value for a newly created generator, or resets the
value of an existing generator. A generator provides a unique, sequential numeric value
through the GEN_ID() function. If a newly created generator is not initialized with SET
GENERATOR, its starting value defaults to zero.
int is the new value for the generator. When the GEN_ID() function inserts or updates a
value in a column, that value is int plus the increment specified in the GEN_ID() step
parameter.
saluditos

PD: quiero un gallifante de oro por la respuesta
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.

Última edición por Lepe fecha: 12-10-2006 a las 20:36:04.
Responder Con Cita
  #3  
Antiguo 12-10-2006
aladelta aladelta is offline
Miembro
 
Registrado: jul 2003
Posts: 70
Poder: 21
aladelta Va por buen camino
Hola

¡¡¡Un gallinfante de oro!!!!!!

aaalaaaaaaa

Si al menos lo hubieses escrito tu, pero encima me toca traducir, tio..

Mejor te pago una ronda, y ademas me apunto yo...y no me rajo..¿vale?

Muchas gracias....
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
como actualizar firebird 1.5 a firebird 2.0 cidarta Firebird e Interbase 3 26-04-2006 08:57:07
Firebird : Llamado para probadores de Firebird 2.0 JOSEPE Firebird e Interbase 0 12-03-2005 20:33:18
Problemas Con Scripts Sql en IboConsole El_Perrito Firebird e Interbase 0 12-08-2004 19:47:50
Problemas Firebird Super Server 1.5 con RFunc Firebird v 1.0 Prophoenix Firebird e Interbase 1 09-03-2004 11:40:48


La franja horaria es GMT +2. Ahora son las 12:04:40.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi