Results 1 to 3 of 3

Thread: SQL Question - easy!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Isle of Man
    Posts
    276
    What's wrong with this query??

    SELECT * FROM Ticket
    WHERE WspanRef IS NOT NULL AND WSpanRef <> ''
    AND TimeStamp < '31/07/00'
    ORDER BY TimeStamp;

    It's running on a sql 7 database, and TimeStamp is a datetime field automatically filled in by setting it's default to getdate()

    when I try to run the query, I get 'the conversion of char data type to datetime data type resulted in an out of range datetime value'

    This seems to imply that i've entered the date incorrectly. I tried entering the date in the american format (mm/dd/yy), but to no avail. I also tried using a # instaed of a ' around the date (a la access) but that didnt work either.

    I know that this is something really simple, but I'm at a dead loss to explain it.

  2. #2
    Junior Member
    Join Date
    Dec 1999
    Location
    westmids
    Posts
    18
    it may because your trying to pass a string to the database when it should be a date type

    if this is the case the you will need to use the date function of trasact sql to change it to a date type
    look if the date function in your sql7 tsql reference book there are loads of the them.

    or even better use the convert function (tsql again)

  3. #3
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Try this
    ???? < '07/31/2000' You need to follow expand the date
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

Posting Permissions

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



Click Here to Expand Forum to Full Width