Click here to Skip to main content
11,637,415 members (65,653 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL2000 SQL
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
MAX(column_name) + 1
for that situation it is not possible.

Thanks in advance.
Posted 22-Mar-13 0:04am
Why IDENTITY column does not work for you?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

IDENTITY is supported in SQL Server 2000. Please check below link[^]
Prasad_Kulkarni at 22-Mar-13 6:55am
Exactly, A 5!
wonder-FOOL at 27-Mar-13 3:50am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can use COUNT function.
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.

wonder-FOOL at 27-Mar-13 3:51am

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 314
1 OriginalGriff 295
2 stibee 288
3 270
4 himanshu agarwal 209
0 OriginalGriff 9,031
1 Sergey Alexandrovich Kryukov 8,643
2 Mika Wendelius 6,959
3 F-ES Sitecore 2,388
4 Suvendu Shekhar Giri 2,320

Advertise | Privacy | Mobile
Web03 | 2.8.150728.1 | Last Updated 23 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100