Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Having a row with empty unique field?
Message
De
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:
01520280
Vues:
39
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform