SQLSERVER: how to change an existing primary key of an int table to become an identity column?

My database has a table with thousands of records. The primary key is an integer. There are many foreign key restrictions in this column.

I want to change this column to become an identity key. What is the best way to do this? I also need to send this update to install our clients.

Reward points for a response that runs on Sql Server 2000.

+5
source share
4 answers

SQL Server Management Studio has a great feature that saved my day.

SSMS "" → "" → " ", " " " , ".

, Identity. . " " "()" "". " script". .

script, constrainsts, . WOW!

.

: . , script .

. , , , 3 !

+11

Enterprise Manager , .

(, , , , , - 1

+1

"ALTER TABLE" DDL . .

Enterprise Manager, , Sql . . , http://www.mssqltips.com/tip.asp?tip=1397

, script -, fk.

+1

, . ! .

ALTER TABLE , Enterprise Manager.

0

All Articles