Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004

    Unanswered: How tell sql to consider a value as Date Time

    as you know when you want to tell sql to conside a value as STRING, put a " around the value.
    i want it for date value, somethin that works like this for me: CONVERT(datetime,'2003-06-07').
    in some languages # around the values works, but in sql?

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    If you present a SQL string that is in the ISO 8601 format (CCYY-MM-DD), anywhere that a date is acceptable, SQL Server will automagically convert it to a date for you. I don't know of any prefix or quote character that will force the conversion.


  3. #3
    Join Date
    Apr 2002
    Toronto, Canada
    pat, i think you forgot to mention that the yyyy-mm-dd value must actually be presented inside single quotes

    you cannot say WHERE orderdate = 2006-02-28

    you have to say WHERE orderdate = '2006-02-28'

    bono mentioned using #'s around the value, which works in access, and was asking about what to use in sql server

    the answer is single quotes | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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