Reputation: 57
I need to set my column property to NOT NULL, but I'm not able to set the property it produces the below error..
MY Query:
ALTER TABLE CartReceBenif
ALTER COLUMN RecipientId int NOT NULL;
ERROR
Msg 515, Level 16, State 2, Line 1 Cannot insert the value NULL into column 'RecipientId', table 'test.dbo.CartReceBenif'; column does not allow nulls. UPDATE fails. The statement has been terminated.
Can any one suggest what is the mistake..
Upvotes: 0
Views: 1670
Reputation: 48
Possible data present in this table and null values in this column. Try to update table, set values in this column to 1 for example before altering. Or just remove all data from the table before altering.
Upvotes: 3