Can i use a SELECT statement to define a CHECK constraint?
Posted
by
Neel
on Stack Overflow
See other posts from Stack Overflow
or by Neel
Published on 2011-01-05T06:58:50Z
Indexed on
2011/01/05
7:53 UTC
Read the original article
Hit count: 438
In MS SQL server, can i use a SELECT statement to define a CHECK constraint? Say i have to work with two tables "Customer Master" and "Indian Customer" in ideal situation both tables are compleatly different, and are not interrelated in anyways. however they share the same database
Content of "Customer Master":
CustomerName (colomn): a, b, c, d, e
Branchlocation (colomn): IN, AU, IN, IN, UK
Content of "Indian Customer":
customerID (colomn): 1, 2, 3
CustomerName (colomn): a, c, d
customer details (colomn): details1, details, details
.
.
.
In Table "Indian Customer" i want to put a constraint so that the users entring data in this table should not be able to enter customers that dont exist in "Customer Master" or whose branch location is not IN. also the tables are in the same project but are not directly related.
© Stack Overflow or respective owner