Results 1 to 5 of 5

Thread: smalldatetime

  1. #1
    Join Date
    Feb 2004
    Location
    Bangalore, India
    Posts
    250

    Question Unanswered: smalldatetime

    im getting this error while inserting into table (description of table given below)

    mytable
    mycode smallint identity,
    mydataitem varchar(100),
    mydatefrom smalldatetime,
    mydateto smalldatetime,
    myopcode smallint,
    lastupdate smalldatetime

    my sql statement was

    INSERT INTO mytable
    (mydataitem,mydatefrom,mydateto,myopcode,lastupdat
    e)
    VALUES
    ('SAMPLEDATA','01/01/2003','18/05/2003',1,'05/Mar/2004')

    THE ERROR RETURNED IN MY CLIENT APP IS
    [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.

    AND THAT IN QA IS

    Server: Msg 296, Level 16, State 3, Line 1
    The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
    The statement has been terminated.

    can ne 1 point out the mistake in my sql statement ?


    __________________
    Cheers....

    baburajv
    Cheers....

    baburajv

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Sure, your localization probably is one that expects dates as MM/DD/YYYY, and the second date won't convert. The easy option is to specify dates using the ISO format, like 2003-05-18 which works with ANY localization. If that isn't to your liking, give SQL Server dates that match the server's localization parameters.

    -PatP

  3. #3
    Join Date
    Feb 2004
    Location
    Bangalore, India
    Posts
    250

    Smile

    thanks a lot .. it worked


    Originally posted by Pat Phelan
    Sure, your localization probably is one that expects dates as MM/DD/YYYY, and the second date won't convert. The easy option is to specify dates using the ISO format, like 2003-05-18 which works with ANY localization. If that isn't to your liking, give SQL Server dates that match the server's localization parameters.

    -PatP
    Cheers....

    baburajv

  4. #4
    Join Date
    Feb 2004
    Posts
    199
    or use CONVERT statement
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Originally posted by Kakha
    or use CONVERT statement
    How would you do that???

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •