INSERT

  • 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

  • Read about SET DATEFORMAT on BOL.

    _____________
    Code for TallyGenerator

  • 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

  • Carl, you're wrong.

    Try '2007-04-24' with DATEFORMAT dmy

    _____________
    Code for TallyGenerator

  • Hi,

    Thanks every body it will inserted

    i am not follow the exact method

    YYYY-MM-dd

    Thx

  • 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)

  • 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