Subject | Autoincremented Fields in Delphi |
---|---|
Author | gato2707 |
Post date | 2005-07-15T22:27:02Z |
Hi everybody:
I'm trying to use an autoincrement field in a table, the field is part
of the primary key. First I used a trigger calling a generator, but
when insert a new record in my Delphi application i discover is
neccesary to write any value in the field BEFORE the post operation,
otherwise an error occurs. Then I read best way to do that is thru a
StoredProcedure, well, I cant't find where call that procedure. Any
sugestion?
CREATE TABLE MYNAMES
(
MYCODE INTEGER,
MYNAME CHAR(30)
)
CREATE PROCEDURE A_NEW_CODE
RETURNS (NEWCODE INTEGER)
AS
BEGIN
NEWCODE = GEN_ID(MORECODES, 1);
/* MORECODES IS A GENERATOR */
END
I'm trying to use an autoincrement field in a table, the field is part
of the primary key. First I used a trigger calling a generator, but
when insert a new record in my Delphi application i discover is
neccesary to write any value in the field BEFORE the post operation,
otherwise an error occurs. Then I read best way to do that is thru a
StoredProcedure, well, I cant't find where call that procedure. Any
sugestion?
CREATE TABLE MYNAMES
(
MYCODE INTEGER,
MYNAME CHAR(30)
)
CREATE PROCEDURE A_NEW_CODE
RETURNS (NEWCODE INTEGER)
AS
BEGIN
NEWCODE = GEN_ID(MORECODES, 1);
/* MORECODES IS A GENERATOR */
END