ingo schuster wrote:
>
> At 19:22 2000-11-28, John McNally wrote:
>
> > >
> > > 5. The latest version of DB2 supports auto-increment fields, keyword
> > > GENERATED ALWAYS AS IDENTITY.
> > >
> >
> >what is the sql to retrieve the id after a row is inserted?
>
> Just use the column name. I give you an example:
>
> The PERMISSION table is created as follows:
>
> CREATE TABLE TURBINE_PERMISSION
> (
> PERMISSIONID INT GENERATED ALWAYS AS IDENTITY,
> PERMISSION VARCHAR (99) NOT NULL,
> OBJECTDATA BLOB (16777215),
> UNIQUE (PERMISSION)
> );
> ALTER TABLE TURBINE_PERMISSION
> ADD CONSTRAINT TRB_PERM_PK
> PRIMARY KEY (PERMISSIONID);
>
> You enter a new row...
>
> INSERT INTO
> INGO.TURBINE_PERMISSION ( PERMISSION ) VALUES ( 'test' )
>
> ...and retrieve the generated ID like this:
>
> SELECT
> INGO.TURBINE_PERMISSION.PERMISSIONID AS PERMISSIONID
> FROM
> INGO.TURBINE_PERMISSION
>
> ingo.
What is it about this command that it does not retrieve every row? Does
the database keep track that the previous SQL from the connection was an
insert and you are now requesting the autoincrement column?
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]