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);

asked 15 Jan '10, 00:51

Calvin%20Allen's gravatar image

Calvin Allen
1.5k232638
accept rate: 25%


You can make a call to

select get_identity('people') from dummy;

which will get the next available number for that table.

permanent link

answered 15 Jan '10, 00:52

Calvin%20Allen's gravatar image

Calvin Allen
1.5k232638
accept rate: 25%

1

Excellent information! Thanks!

(15 Jan '10, 14:35) Calvin Allen
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×113

question asked: 15 Jan '10, 00:51

question was seen: 665 times

last updated: 15 Jan '10, 00:52