NULLS in datetime | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

NULLS in datetime

which is the better way? do i need to allow nulls for date time field or set it to some default value/blank or anything else. wud like to know best way to design so tht developers dont get any errors regarding. Thanks!
"He laughs best who laughs last"
Either way will be fine as long as your developers know how to deal with the 3VL when NULLs are involved. If your logical model allows to specify a DEFAULT and make that column NOT NULL, go for it. Your queries will become less complex. —
Frank Kalis
Microsoft SQL Server MVP
Heute schon gebloggt?

There is nothing wrong in having Null date as long as you know how to handle them as Frank said
Also refer this to know more on Dates Madhivanan Failing to plan is Planning to fail
If the entity has a date attribute, but it is optional, then you need a nullable column for it. That’s reality for you, and don’t even start thinking of a default ‘zero’ date – let’s not go back to programming around 9-9-9999 … bad idea! Programmers should know how to handle nulls. If they don’t, get them reassigned to other projects (to put it mildly). If they don’t know how to handle international date formats, then even more reason to etc., etc.
I would agree that columns like birthday hardly can have a DEFAULT and therefore ought to be NULLable. However, columns like OrderDate can very well have a DEFAULT of GETDATE(). <br /><br />Either way, a professional SQL developer should, of course, know how to handle NULLs. All I meant is, that there is no sense in making life harder than it actually is. [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />–<br />Frank Kalis<br />Microsoft SQL Server MVP<br /<a target="_blank" href=></a><br />Heute schon gebloggt?<a target="_blank" href=></a><br />