In SQL Server 2005, I have a PK (name is userid) in table users, when I view properties by right click - design, I can see its Inentity Specification is NO, I want to change it to Yes, anyone knows how to change it? Thanks,
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
Verified answer
From the Management Studio, open up Databases, the database you want, Tables, the table you want, Columns, right-click the column you want to change (userid in your case) and select Modify. A window will open up with a tab that says Column Properties. Open "Indentity Specification" property, find "(Is Indentity)" and set it to "Yes". Click on Save to save the change.
If you want to do it in a query window, you should rename the table, create a new table (with the identity field), turn on IDENTITY_INSERT, and copy the table. Too much work!