Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello CPers,

I would like to know is it possible to make a column auto-increment without changing it to IDENTITY in SQL Server 2000. As far as I know it is not supported in SQL2000 but is there someone who might implemented this?

For those who might suggest me to use
SQL
MAX(column_name) + 1
for that situation it is not possible.

Thanks in advance.
Posted
Comments
José Amílcar Casimiro 22-Mar-13 6:30am    
Why IDENTITY column does not work for you?

IDENTITY is supported in SQL Server 2000. Please check below link
http://msdn.microsoft.com/en-us/library/aa933196(v=sql.80).aspx[^]
 
Share this answer
 
Comments
Prasad_Kulkarni 22-Mar-13 6:55am    
Exactly, A 5!
wonder-FOOL 27-Mar-13 3:50am    
THanks.
Hey,
You can use COUNT function.
SQL
select count(*) from your_table

Get the count of the record in the table and add 1 to it.
But, this will work fine only if you are not deleting the records physically from the table otherwise it will work in any condition.

Hope this helps you.

Regards,
Lok..
 
Share this answer
 
Comments
wonder-FOOL 27-Mar-13 3:51am    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900