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!
Loading
uttu shresthaPosted May 10, 2007, 8:31 PM
Scott LyslePosted May 6, 2007, 4:02 AM
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 shresthaPosted May 5, 2007, 8:46 AM
Well! I am using Oracle 9i as a backend. Could you please suggest me?
Scott LyslePosted May 5, 2007, 4:06 AM
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.