how to give a check constraint to a character coloumn
How can i give a check constraint to a column whose datatype is char(1)
coloumn name--->group
datatype------->char(1)CHECK(c,s,a)
plz tell me the exact query how to insert it in开发者_Go百科to sqlserver2005 while creating a table,, in which group is a column...
Thanks, Churchill
From your question, it seems as though you only want to allow the value c, s, or a. If I understand correctly....
Create Table YourTableNameHere(
Id Int,
col Char(1)
Constraint ConstraintNameHere Check(Col In ('c','s','a')))
精彩评论