Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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[^]
 
Share this answer
 
v2

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