PDA

Click to See Complete Forum and Search --> : SQL Question - easy!


Jimbob
Aug 1st, 2000, 07:48 AM
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':confused::confused::confused::confused::confused:

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.

nexus
Aug 1st, 2000, 09:09 AM
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)

parkes
Aug 1st, 2000, 09:19 AM
Try this
???? < '07/31/2000' You need to follow expand the date