Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Correct check constraint syntax?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-15 : 10:28:12
Hendrik writes "I having a problem figuring out the correct syntax for a column constraint. What I have to work with is:

[table1.numeric_column1] BETWEEN [table2.numeric_column2] - 20 AND [table2.numeric_column2] + 20

The idea is, when a number is entered into numeric_column1 I would like to ensure that the number entered is within the range of a column in another table subtracted by 20 and added by 20."

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-05-15 : 11:01:48
From BOL:
A CHECK constraint can validate a column value only against a logical expression or another column in the same table. If your application requires that a column value be validated against a column in another table, you must use a trigger.
Go to Top of Page
   

- Advertisement -