Sunday, February 12, 2012

Auto Increment

I have a table that is already populated w/o a primary key. Now I want to have a column that is an int starting at 1 and increments by 1. How do I do this?

Try:

alter table dbo.t1

add sk int not null identity(1, 1) constraint pk_t1 primary key clustered with fillfactor = 85;

go

AMB

No comments:

Post a Comment