Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2012-12-22
3
Medium Priority
?
757 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 43

Accepted Solution

by:
Eugene Z earned 1000 total points
ID: 38716460
try:

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

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 1000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

597 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