October 31, 2007 at 1:22 am
Hi Experts,
How a table which contains foreign key relationship accepts more than one NULL value ? What is the reason ? which logic is applied here ?
For example,
Table A - Master Table , Eno - Primary key
Eno Name
1 aa
2 bb
3 cc
4 dd
5 ee
Table B - Child Table, Eno - Foreign Key
Eno Age
1 21
2 25
3 55
Null 34
Null 52
Null 42
Null 48
Null 31
How it accepts null value ? What concept is applied here ?
Regards:cool:
Karthik
karthik
October 31, 2007 at 2:49 am
Hi Karthik,
nulls are handled differently in foreign keys. A quote from books online:
"if any column of a composite FOREIGN KEY constraint contains null values, verification of all values that make up the FOREIGN KEY constraint is skipped."
If you want to avoid this, you can specify "NOT NULL" for the referencing columns.
You can read more in Books Online: http://msdn2.microsoft.com/en-us/library/ms175464.aspx
Regards,
Andras
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply