Create a new table AB which stores a relationship between table A and table B, then create foreign key relationships between the columns in AB and the respective columns in table A and B.
Then when you select out you can left join table A to table AB and if there is a null then you know there is no corresponding row in B. Chris -----Original Message----- From: Raj Malli [mailto:[EMAIL PROTECTED] Sent: Saturday, 26 February 2005 12:53 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: [ADVANCED-DOTNET] Foreign key relation in which foreign key is null Hi guys I have a dataset with two tables A and B. A's primary key field ID is a foreign key field ID_A in table B (I set this relation up in the dataset using the "Edit Relation" UI screen). Now, is it possible that ID_A be a nullable field? (My business rule is this: If ID_A is non null, a corresponding parent row needs to exist in table A). I have specified ID_A as a nullable field in the Sql Server 2000 DB, but do not know to specify that in the data relation. Currently, if I set ID_A to null in the dataset, I get a constraint violation thrown. Any pointers are appreciated Thanks Raj =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com ###################################################################### Attention: This e-mail message is privileged and confidential. If you are not the intended recipient please delete the message and notify the sender. Any views or opinions presented are solely those of the author. This email was scanned and cleared by NetIQ MailMarshal at Simbient. ###################################################################### =================================== This list is hosted by DevelopMentorŪ http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com