October 15, 2005 at 1:50 am
October 15, 2005 at 6:57 am
The Convertion of char data type to a datetime type resulted in an out-of-range datetime value.
-> results in a date before 1753
Look up CONVERT for an extra format parameter.
October 17, 2005 at 7:41 am
Take a look of what language are your database using ??? try using the convert function with the format date parameter.
October 17, 2005 at 10:15 pm
Dear Friend,
Use this query
Syntax for Convert functions
=====================
CONVERT([datatype],[fieldname],[formattype])
SELECT CONVERT(datetime, date,101) FROM ConvertTable
I hope you can get the result what u expect.
M.Pothiraja
October 18, 2005 at 1:34 am
As far as I can remember, you get this error message if one of the strings to be converted:
1) does not result in a date at all (incorrect entry)
2) does not result in a date in a valid timespan for datetime (e.g. year 1645)
3) does not translate to a correct date, given your settings (e.g. entry as RRRR/MM/DD and environment setting RRRR/DD/MM - attempt to translate some dates to a month 21 etc.)
Both CAST and CONVERT are acceptable, but if you have problems, try CONVERT. There are more possibilities to influence the result using parameters - see BOL for more detail.
October 19, 2005 at 4:14 pm
The above response indicated the exact scenario you might be running into. However, to check which one of these conditions you are encountering, you could open a cursor and check which particular date is causing the out of range date.
October 20, 2005 at 7:24 am
thxs for ALL........
i have get the answer...
now i have a problem, how to show a "tab" in record
my sentence like this "EKO INDRIYAWAN"
when i insert into record become "EKOINDRIYAWAN"
anyperson who can help me ???
July 13, 2010 at 6:42 am
Hi,
Could you please try this example and let me know if you are able to convert date to varchar without any issues.
eg: Create table #temp(currDate varchar(20))
insert into #temp values(CONVERT(varchar(10),getdate(),121))
SELECT cast(currDate as Datetime) as currDate from #temp
September 15, 2011 at 7:36 am
The query :- SELECT CONVERT(datetime, dt,101) FROM [TestDB].[dbo].[test_date]
gave me the error:-
Msg 242, Level 16, State 3, Line 1
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
September 15, 2011 at 8:59 am
@dcs.. - why did you choose the parameter setting '101'? Look up the command (Books OnLine [BOL], or brute force via Google) and make certain you understand your date formatting correctly. If you specify the wrong format, that will yield your error. Otherwise, it may be a data cleansing challenge.
September 16, 2011 at 1:25 am
steve smith-401573 (9/15/2011)
@dcs.. - why did you choose the parameter setting '101'? Look up the command (Books OnLine [BOL], or brute force via Google) and make certain you understand your date formatting correctly. If you specify the wrong format, that will yield your error. Otherwise, it may be a data cleansing challenge.
Hi Steve,
Thanks for you response. I used 101 for mm/dd/yyyy format. Anyways its working now. Many Thanks
Cheers,
DCS
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply