Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Null vs. Zero for Primary Key
Message
From
19/01/2011 15:29:20
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01496573
Message ID:
01496581
Views:
79
We are converting to a SQL Server database, and were debating whether to have the primary keys default to zero or null. What are the advantages/disadvantages to each?

Hi, Jerry, I disagree in concept with the notion of zero or null keys - especially in (but not limited to) data warehousing scenarios.,

For instances where a business entity is null (like for instance...5% of your orders don't have a cost center), the recommended practice in most data warehousing circles is to store an "undefined" cost center in the cost center master....and then use that PK in the orders table.

If you ever take your database and utilize analytic tools down the road, you'll be glad you took this approach. (Conversely, some wind up regretting the use of NULLs when building OLAP databases.)

NULLs and zeros really don't belong in PK/FK relationships. Nothing to gain, and potential problems down the road.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform