Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Null in DateTime

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2012-07-17 : 05:14:32
Hello,

I am working on a USERS table which has a few DateTime field. For example:

LastLock datetime not null,

PasswordAttemptStart datetime not null

The problem is that these fields might be null.

Should I allow then to be null or use the Minimum SQL Date?

In my application I can check the columns for NULL or Minimum SQL Date.

But what would be the best approach?

Thank You,

Miguel

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-07-17 : 05:17:57
Personal preference - and depends on what the people who are accessing the data can cope with.
I would go for 19000101 for the data yoou have suggested here.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-17 : 09:46:12
our case it depends on scenario. if we're representing some range with date values we uasually put min date and maxdate instead of nulls. Otherwise we leave it as NULL

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -