As it said, I want to add a constraint to a table, and find cannot make Check and Select together.
Here is What I did:
Alter Table table2 Add Constraint chk_table2 Check(Colume21 IN (Select Colume11 From Table 1));
Why does it fail?
As it said, I want to add a constraint to a table, and find cannot make Check and Select together.
Here is What I did:
Alter Table table2 Add Constraint chk_table2 Check(Colume21 IN (Select Colume11 From Table 1));
Why does it fail?
The documentation says:
The expression of a CHECK constraint may not contain a subquery.
In any case, you cannot use ALTER TABLE to add a constraint later.
However, your constraint looks like a foreign key, which is supported.