[dba-SQLServer] NULLs

Dan Waters dwaters at usinternet.com
Mon Mar 16 10:33:28 CDT 2009


On 3:

If my tables were set up this way, I would have a department called
'Pending' into which all new employees would fall.  Later when you decide
the department you can change the FK.

If I've set up a FK in a table, then I always want it populated.  

Dan


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Asger Blond
Sent: Sunday, March 15, 2009 6:24 PM
To: 'Discussion concerning MS SQL Server'
Subject: Re: [dba-SQLServer] NULLs

Coming in late I have a few comments here.
1. In SQL Server you can make indexes on NULL allowed columns, and the
engine sure will use these indexes if they are useful for the queries.
2. The column order of NULL allowed columns is of no importance in SQL
Server as it maintains header information for each row telling if NULL
allowed columns have a value or not.
3. And Arthur: "obviously I forbid them in any FK column". Don't agree,
seems quite allowable to me. Imagine you have a Department and an Employee
table. Your Employee table has a FK referencing the Department table. Now
you just hired a new employee but haven't decided yet the department for the
employee. Isn't it reasonable to make a record for the new employee leaving
the FK column NULL? 

Asger






More information about the dba-SQLServer mailing list