Re: Date and Null

shapper (mdmoura@xxxxxxxxx) writes:

On my Users table I have a column named LastLock.
This column holds the last date where the account was locked.

The problem is that some users where never locked.
So I suppose I should use null for this column correct?

That would be my choice of design.

And in my C# code can I check if a SQL table column of type date is

Yes, just like for any other data type.

Or is there a specific Date for not defined dates?

You can define your own magic date, but if you then mess up on
which date that was, you will have a problem. The advantage of NULL
is exactly that: it's easy to remember.

Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008:
SQL 2005:
SQL 2000: