Click here to Skip to main content
15,888,027 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
how to add identity(1,1) into existing column in a table
Posted
Comments
Legor 23-Aug-12 7:22am    
Improve the question with more details please. What problems do you have exactly?

AFAIK, you cannot add the IDENTITY property to an existing column.

However, you can add a new IDENTITY column to the table:
SQL
ALTER TABLE Users ADD UserID int NOT NULL IDENTITY(1,1) 
 
Share this answer
 
You can edit a table in the design view to have that, so long as there's no repeating values, I believe. However, it seems like an odd thing to add after the fact ?
 
Share this answer
 
Comments
Umapathi K 23-Aug-12 7:29am    
s

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