Monday, March 12, 2012

Primary Key

Through code i am trying to script a table that has multiple columns as the primary key

CONSTRAINT col1, col2 PRIMARY KEY doesn't work

and when put primary key after each column that doesn't work either.

Any ideas?

CREATE TABLE [dbo].MyTest(test1 int not null, test2 int not null)

ALTER TABLE MyTest

ADD CONSTRAINT NEW_PK PRIMARY KEY(test1, test2)

Adamus

No comments:

Post a Comment