Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Making FK Constraint to ignore empty records
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01639981
Message ID:
01640009
Vues:
49
>>I just did a little test, after setting the FK (as per code below). Then I added a couple of records to the EQ_FILE with different value in SITE_NO and NULL in CATEGORY. And no problem; no violation of FK constraint. Does it mean the SQL Server automatically ignores NULL values when checking FK constraints?
>>
>
>SQL Server does not enforce FK when any child table column value in FK relationship is null. Which means, when CATEGORY is null, SITE_NO will not be enforced

This will work for me. I just need to make sure that by changing the CATEGORY from empty to NULL, something else it the program does not break. I can see that since I will have to change the FK in some other tables (because of the new field SITE_NO), I will have to start using NULLs more.
Thank you!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform