Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DateCompare in SQL Query ???

Status
Not open for further replies.

Markh51

Programmer
May 20, 2003
81
0
0
GB
How do I use date compare in my SQL query's ??

I have tried:
...AND DateCompare(getDate(), lot.lotOpenDateTime) <> -1

but I just keep getting an error saying DateCompare is not a recognized function.

If I can use DateDiff in my querys why can't I use DateCompare. Am I doing something wrong ???

Thanks,
Mark
 
You left off pound signs around DateCompare... Don't know if you meant to or not, but that would certainly make a difference.
 
I tried that. I then just says DateCompare is Undefined.
 
BTW,

DateDiff work fine without the '#' signs.

Regards,
Mark
 
you never mentioned which database you're using, mark

that's usually necessary to get the right answer to date function questions

but you left a clue -- getdate() suggests it's microsoft sql server


and datediff(day, lot.lotOpenDateTime, getdate()) <> -1


rudy
 
Thanks to all who replied, it is now all sorted.

Cheers,
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top