Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    1

    Unanswered: how to form query?

    i am using this statement

    select dateadd(dd,1,20010331)


    and it's throwing an error

    Arithmetic overflow error converting expression to data type datetime.

    what's wrong?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    sql server wants to have date strings, not integers

    select dateadd(dd,1,'2001-03-31')
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Quote Originally Posted by sirocco
    i am using this statement

    select dateadd(dd,1,20010331)


    and it's throwing an error

    Arithmetic overflow error converting expression to data type datetime.

    what's wrong?
    You're missing quotes:

    select dateadd(dd,1,'20010331')
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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