Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having a row with empty unique field?
Message
From
06/08/2011 07:41:01
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01520263
Message ID:
01520280
Views:
40
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform