Click here to Skip to main content
14,392,692 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi all

I have a table which contains around 7000+ data.

now i want to add a unique id column on the existing data and also later if user adds
any records, it should increment automatically.

e.g. Below is the existing data

1    name    54
1    name    50
2    age     88
3    place   12....


and i want like this

00001   1    name    54
00002   1    name    50
00003   2    age     88
00004   3    place   12....


Please tell me how to do this

I am sorry, i made a wrong tag.
I search in google and i got something called "serial" for auto-increment id which serves my purpose.

But one thing i want the number to start like this-"00000000001" and so on.
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You did not provide enough information about your issue. So, i assume that the most difficult to you is to create custom autogenerated sequence, for example: 00001.

Follow these steps: http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server[^]
   
v2

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




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