Cast SQL Server date before 1900

Last Post 03 Dec 2008 10:34 PM by SwePeso. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
c9jad
New Member
New Member

--
03 Dec 2008 12:32 PM
I need to take a date in decimal format that is before 1900 and convert it to datetime.

I have the following.

select cast((cast(myfield as char(8)) as datetime)

I am getting an error.

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.


Any help would be appreciated.
c9jad
New Member
New Member

--
03 Dec 2008 01:57 PM
My issue was that there was this date 19000229, which is not a leap year.
SwePeso
New Member
New Member

--
03 Dec 2008 10:34 PM
You are not authorized to post a reply.

Acceptable Use Policy