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
null?

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: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

.



Relevant Pages

  • Re: SQL account rights
    ... Please advice what is the best, suitable rights rather than domain admin ... Warren Brunk - MCITP - SQL 2005, ... Add it as a login to the SQL Server ... files, or backups, make sure that the service account has Full ...
    (microsoft.public.sqlserver.security)
  • Re: User authentication
    ... There are 2 SQL Server 2005 ... 1 SQL Server 2000 installed on another server ... Windows account instead to run backup jobs. ...
    (microsoft.public.sqlserver.clients)
  • Re: SQL 2000 Server gets hacked
    ... Thank you Beth. ... > placed a strong password on the 'sa' account?) ... Your SQl Service itself shouldn't be running as a ... (SQL Agent requires more, but not SQL Server). ...
    (microsoft.public.sqlserver.security)
  • Re: SQL 2000 Server gets hacked
    ... Thank you Beth. ... > placed a strong password on the 'sa' account?) ... Your SQl Service itself shouldn't be running as a ... (SQL Agent requires more, but not SQL Server). ...
    (microsoft.public.sqlserver.security)
  • Re: Microsoft Search service cannot be administered under the present user error SP3
    ... - Have not modified Administrator account, but i ran the SQL script anyway. ... SQL account is not a local administrator. ... > has this server ever been upgrade from SQL Server 7.0 or is this SQL ...
    (microsoft.public.sqlserver.fulltext)