i have inherited a database application from someone else and there are a few table开发者_运维知识库s that dont have any primary keys. I want to add a new column into an already existing table and have it autonumber (starting from 1). how would i go about doing this?
The SQL Server syntax is:
ALTER TABLE SomeTable ADD
ID int NOT NULL IDENTITY(1, 1),
CONSTRAINT PK_SomeTable PRIMARY KEY [NON]CLUSTERED (ID)
精彩评论