September 16, 2007 at 12:09 pm
Hi friends,
insert into customers values('Ganesh','Sri','Sri_ganesh@gmail.com',
'24/4/98',641234)
In this insert statement i am entering date only day 0-9 is accepted but 11-30 it will showing below error
-------------------------------------------
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.
-------------------------------------
can u any body plz help me
Thx
subu
September 16, 2007 at 2:56 pm
Read about SET DATEFORMAT on BOL.
_____________
Code for TallyGenerator
September 16, 2007 at 5:44 pm
is '24/4/98' can be interpreted as the 24th month with 4th day OR as the 24th DAY, the 4th Month. Which interpretation is dependent on the DATAFORMAT setting for the connection.
Suggest you specify dates in the International Standard Organization format of YYYY-MM-DD, which is always interpreted in the same manner.
SQL = Scarcely Qualifies as a Language
September 16, 2007 at 6:26 pm
September 16, 2007 at 11:16 pm
Hi,
Thanks every body it will inserted
i am not follow the exact method
YYYY-MM-dd
Thx
September 17, 2007 at 8:29 am
set
dateformat dmy
select cast('2007-04-24' as datetime) -- fails
select cast('20070424' as datetime) -- works
select cast('2007-04-24T12:00:00' as datetime) -- works (this is ISO 8601 format)
September 18, 2007 at 2:51 pm
you are correct.
SQL = Scarcely Qualifies as a Language
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply