PDA

View Full Version : Advantage DB query syntax for date range


CraigYellick
May 18th, 2020, 10:47 AM
I'm a SQL Server guy and don't query Advantage DB directly very often so am weak on syntax subtleties. Am trying to fetch all charges between two dates and no matter what variations I try it's always some kind of conversion failure or invalid operator for the type.

select * from slips
where SlipDate >= '05/09/2020 12:00:00 AM'
and SlipDate <= '05/15/2020 12:59:59 PM'

I've tried formatting the dates as 2020/05/09 and 2020-05-09, even tried doing a CONVERT to sql_timestamp. Nothing works.

One complicating factor is I'm doing this through a linked server query and quoted strings are a pain with the OPENQUERY() function so if the above is supposed to be working than that'll be important to know.

Thanks for any advice!

-- Craig

Support Team
May 18th, 2020, 12:36 PM
Thank you for asking. Please give the following a try:

select * from slips
where SlipDate >= '05/09/2020 00:00'
and SlipDate <= '05/15/2020 23:59'

CraigYellick
May 18th, 2020, 01:12 PM
Thanks for such a quick response. That's one variation I had not tried.