Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Having a row with empty unique field?
Message
 
 
À
06/08/2011 07:41:01
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01520263
Message ID:
01520292
Vues:
38
>>I am wondering if the following approach would be considered bad or unconventional design. Or if this is Ok.
>>
>>I have a parent table with the unique index key. This table has one or more child tables which have foreign keys. A referential integrity constraint is set for the foreign key to the parent (unique) key. What happens is that when a user deletes an entry in the parent table the foreign keys in child tables have to be set to NULL. I prefer that instead of NULL the value in child tables would be set to empty string. In order to be able to do that, without breaking the referential integrity, the parent table has to have a row with the empty string entry in the unique index key. So this is what I want to do. I want to leave one row in the parent table with the empty string in the in the unique column/field. And of course the user will never see this row of parent table (with empty string); there is a simple way to hide it.
>>
>>Is the above design generally acceptable?
>>
>
>If your UC needs the records in the child table to remain - yes -
>but I'd ask first for written order/description of the UC, as I prefer cascading deletes ;-)
>
>regards
>
>thomas

Sorry but I don't know what is the "UC". Could you please explain.
"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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform