Monday, 12 December 2011

Cannot define PRIMARY KEY constraint on nullable column in table

Hi All,
I used the below to alter table attributes



To add primary key
ALTER TABLE CSAT
ADD PRIMARY KEY ([Sl No])

While doing so, I got the below error
Cannot define PRIMARY KEY constraint on nullable column in table

So I used the below

ALTER TABLE CSAT ALTER COLUMN [Sl No] float NOT NULL


Viola

No comments:

Post a Comment