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.
| Author |
Topic |
|
jamesdwhite
Starting Member
9 Posts |
Posted - 2007-02-09 : 12:24:50
|
| Hi i have a table t1 and wish to have to fk's now i want to be able to set it up so that only one of them can be null example:t1id___________fk1________fk21____________6__________NULL2____________NULL_______33____________7__________NULL4____________NULL_______NULL <<<<<<< This should not be allowed thanksjames |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2007-02-09 : 15:35:01
|
| What about a check constraint;alter table ... add constraint CHK_oneMustBeNull check(coalesce(fk1,fk2) is not null and (fk1 is null or fk2 is null))rockmoose |
 |
|
|
|
|
|