Solved

Best Default "Value" for DateTime column

Posted on 2014-01-06
6
155 Views
Last Modified: 2014-01-07
Curious which is better, NULL or 1/1/1900
0
Comment
Question by:cat4larry
  • 3
  • 2
6 Comments
 
LVL 69

Accepted Solution

by:
ScottPletcher earned 250 total points
ID: 39760179
It depends.

Do you want to automatically ignore missing dates or not?

If you do, NULL is better; if not, 1/1/1900 might be better.
0
 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39760199
As per the design perspective,
it should always be NULL, no default value should be put in that place...

As you see if NULL is the default value, then the application can be programmed to ask the user or prompt the use to enter that date.
but if a default value is put in that place, then it may not, not only that NULL's are specifically designed for this purpose in the database.
0
 

Author Comment

by:cat4larry
ID: 39760200
What becomes difficult is that the table (and its data) will be used in all sorts of ways.  So I'm just looking for a general "start with this" kind of advice.  I can always modify the nature of the data later if I find it isn't working.  Understand?  So back to my original question is it better in general to leave it NULL or 1/1/1900

Hope I'm making sense.
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 16

Assisted Solution

by:Surendra Nath
Surendra Nath earned 250 total points
ID: 39760209
if that is the case, then use 1/1/1900 as this will not throw any error in the application code, where the sloppy application developers have not handled errors.
0
 

Author Comment

by:cat4larry
ID: 39760229
My thoughts as well.  Just wanted to verify with someone else.

Thanks
0
 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39760502
if that answers your question, please close this by awarding the points
thanks Surendra
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Deadlocks 12 50
Permissions on Database 11 37
Updating a column using a lookup on another table. 6 20
SQL - SP needs a little help 9 22
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now