Posted by David Portas on 03/08/06 19:12
J wrote:
> I have seen some look-up tables have no primary key because there is a null
> or " " value in them. Since every table should have a Primary Key, can
> anyone educate me how can I handle null or " " value, in the code level? I
> am avoiding using Surrogate key.
>
>
>
> Thanks,
>
> J
>
>
>
> P.S. Null or " " value is "Unknown".
Nothing technically wrong with ' ' as a key if that makes sense to your
business. If you have nulls then eliminate them either by decomposition
or by encoding the unknown value as something else. There is no excuse
not to have a candidate key.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
[Back to original message]
|