Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate Relationship

Status
Not open for further replies.

gaelin

Technical User
Jan 13, 2004
35
0
0
US
Is there a way to setup a relationship/contraint to validate
if the foreign key data matches a prime key in another table--where the field to be validated may contain nulls?

The field (fkeydoc) is filled if funding is added or subtracted to the table (audit table). When payments occur the field is left null. Hence the field will read:

471
472
null
581
688

 
FOREIGN KEY constraint on FKeyDoc referencing the audit should do the trick. The constraint does not validate NULL against the referenced table, only actual values.

--John [rainbow]
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
 
Using SQL Server 2000, hence not allowed to use a select statement in a constraint.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top