Solved

SQL 2008 default date needs to be 1900-01-01

Posted on 2012-12-22
3
749 Views
Last Modified: 2012-12-23
I am trying to set the "Default Value or Binding" to
1900-01-01

on SQL server 2008

I am getting the error:
Error Validating the default for column 'CreateDate'
Do you want to cancel your changes?

I don't want to use getdate() for my default.  How can I do this?
0
Comment
Question by:ndornack
3 Comments
 
LVL 42

Accepted Solution

by:
EugeneZ earned 250 total points
ID: 38716460
try:

ALTER TABLE YourTable
ADD CONSTRAINT [DefaultConstraintDT]  DEFAULT ('1900-01-01') FOR [YourColumn_CreateDate]
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 38716882
you could also use '' as default value, evaluating as 1900-01-01 also...
the trick is to put the quotes, without the quotes it would be 1900 minus 1 minus 1 which will be 1898, which would evaluated to 1900-01-01 + 1898 days ...
0
 

Author Closing Comment

by:ndornack
ID: 38717436
Thanks for the help, these both work.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

929 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

10 Experts available now in Live!

Get 1:1 Help Now