Hi!
Could you please help me how to generate auto incrementing number ? For ex. when i add new record in the database, before inserting data it should show number say member id 101. when i want to add next record it should show consecutive number say 102. I would appreciate your help.
Thanks!
How to generate auto number?
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Scott LysleRank #49 · 31K reputationPosted May 5, 2007, 12:06 AM EDT
How it is defined varies by database, you can add a column that contains an auto incrementing number to your table; you don't need to physically increment the value in your code; creation of a new record will do that for you.
In SQL Server 2005, you may, in the table designer create a column and set the datatype to int (call it something like IdNum), in the column properties, you may locate the property called Identity Specification, expand it and the then set IsIdentity property to true, the seed and increment values will default to 1.
In MS Access, in the table designer, just create a column with the datatype set to autonum.
uttu shrestha9 reputationPosted May 5, 2007, 4:46 AM EDT
Well! I am using Oracle 9i as a backend. Could you please suggest me?
Scott LysleRank #49 · 31K reputationPosted May 6, 2007, 12:02 AM EDT
CREATE SEQUENCE id START WITH 1 INCREMENT BY 1;
I'm not running Oracle at the moment but you can check the references for Sequence and the documentation should point you in the right direction.
uttu shrestha9 reputationPosted May 10, 2007, 4:31 PM EDT