Results 1 to 3 of 3

Thread: error nvarchar into smalldatetime

  1. #1
    Join Date
    Apr 2006
    Posts
    178

    error nvarchar into smalldatetime

    Hi !

    I am having a problem with MS SQL 2005
    for a column
    [DateInsert] [smalldatetime] NOT NULL

    and that Query

    INSERT INTO Users (DateInsert) VALUES (CONVERT(DATETIME,'2007-12-17',120))

    I am getting a conversion error : nvarchar into smalldatetime

    it seems that I am getting this error only with days > 12

    2007-12-17 does not work but 2007-12-01 works


    any idea ?
    thank you

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You are trying to insert DATETIME value into SMALLDATETIME Column
    Try this

    INSERT INTO Users (DateInsert) VALUES CAST('2007-12-17' as SMALLDATETIME)

  3. #3
    Join Date
    Apr 2006
    Posts
    178
    CAST ? thank you skhanal
    I could anyway solve my problem with yyyyMMdd

    INSERT INTO Users (DateInsert) VALUES ('20071217')

Posting Permissions

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