R
Rafal Konopka
I have a script that communicates with the SQL server (MS), and extracts the
data from a list of fields in one or more tables. No problem works like a
charm.
The problem (actually just an annoyance) is the WHERE clause, where I want
to extract the data only if the given field is equal to a certain date.
I'm using Win32:ODBC module
If my clause reads like:
WHERE open_time='2/5/04/'
or
WHERE open_time='2004-02-05'
(or any legal SQL format for that matter)
nothing is retrieved. It seems that "=" fails. I checked with our SQL guys,
and they claim that the '=' syntax should work.
However, if I use BETWEEN, i.e.
WHERE open_time BETWEEN '2/5/04 00:00:00' and '2004-02-05 23:59:59'
I get what I want.
Why is that? Since I want to compare three date fields, I'd rather use the
"=" than three lengthy 'between' statements.
Thanks,
Rafal
data from a list of fields in one or more tables. No problem works like a
charm.
The problem (actually just an annoyance) is the WHERE clause, where I want
to extract the data only if the given field is equal to a certain date.
I'm using Win32:ODBC module
If my clause reads like:
WHERE open_time='2/5/04/'
or
WHERE open_time='2004-02-05'
(or any legal SQL format for that matter)
nothing is retrieved. It seems that "=" fails. I checked with our SQL guys,
and they claim that the '=' syntax should work.
However, if I use BETWEEN, i.e.
WHERE open_time BETWEEN '2/5/04 00:00:00' and '2004-02-05 23:59:59'
I get what I want.
Why is that? Since I want to compare three date fields, I'd rather use the
"=" than three lengthy 'between' statements.
Thanks,
Rafal