S Nash
S Nash

Reputation: 2499

SQL Server Management Studio when creating check constraints

I use SSMS and want to create a check constraint for a table.

So I right click on constraint node and select New constraint, and I set the expression to Mycolumn > 5

Then I click on close.

After this I do not see this new check constraint added under constraint node. I refresh but still do not see it.

Then I add a row with MyColumn = 2 - nothing happens.

What am I missing here? I use SQL Server 2008.

I need an answer for this using SSMS, I know the answer using T-SQL.

============================================================

Screenshots:

Table definition

enter image description here

enter image description here

Upvotes: 1

Views: 1090

Answers (1)

SQLChao
SQLChao

Reputation: 7847

If you noticed when you click "new constraint" it opens up a tab for the table.

After you click close on the check constraints screen you still need to save the table. You can do this by closing the table window or ctrl + s. It will ask you if you want to save. Say "yes".

Upvotes: 2

Related Questions