SQL Server add a column constraint to limit data to -1 to 1
Posted
by Seth Spearman
on Stack Overflow
See other posts from Stack Overflow
or by Seth Spearman
Published on 2009-11-11T21:35:35Z
Indexed on
2010/06/14
17:22 UTC
Read the original article
Hit count: 474
Hello,
I want to constrain a SQL Server decimal column to only allow -1,0,1 as valid values.
Can you show me the SQL syntax for adding such a constraint. (I would like to know how to do it in both the CREATE TABLE statement and/or the ALTER TABLE ADD CONSTRAINT).
Or can this only be accomplished in a trigger?
Seth
© Stack Overflow or respective owner