cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the next number for a global autoincrement column?

Former Member
1,533

If I had a table defined like below, how, from my application would I be able to get the next value for the "id" column before saving any data to the database?

create table people  
(  
     id not null default global autoincrement(100000),
     first_name varchar(100),
     last_name varchar(100)
);

alter table "people"
    add constraint PK_PEOPLE primary key (ID);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

You can make a call to

select get_identity('people') from dummy;

which will get the next available number for that table.

Former Member

Excellent information! Thanks!

Answers (0)