Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rkalyani
Starting Member
30 Posts |
Posted - 2009-06-09 : 15:49:19
|
I get this error when I run this queryThe conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.SELECT turnaround_time, Receive_Date, Sent_DateFrom(Select Convert(datetime,ALSD) as receive_date,Convert(datetime, dbo.DORD) as sent_date,BCI_WEBII.dbo.DateDiffWeekdays(ALSD,DORD) AS turnaround_time FROM appWHERE ISDATE(ALSD)= 1 AND ISDATE(DORD) = 1 )t where Case when IsDate(Receive_Date)= 1 then Convert(DateTime, Receive_Date) End Between '01/01/2009' and '02/01/2009'group by turnaround_time, Receive_Date, Sent_DateIs there something else I should check?Thank you,kal30 |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-06-09 : 16:06:51
|
try just selecting out the raw char values rather than converting them just to see what values are blowing up. isDate isn't always reliable as a guarantee that the value will convert.Be One with the OptimizerTG |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-06-10 : 00:29:13
|
u should have datetime in format mm/dd/yyyy or yyyy/mm//dd format for conversion of varchar field to datetime |
|
|
|
|
|