[thelist] RE: SQL, Dates and more mental health

rudy r937 at interlog.com
Tue Apr 3 17:22:00 CDT 2001

>   SELECT * FROM tblEvents
>        WHERE view_date BETWEEN 'dteEvStart' AND 'dteEvEnd'

hi ian

that can't be right....  those would be plain old literal character
strings, not dates

ryan, it seems that view_date is the variable being passed to the query, so
all you have to do is make sure it is converted to a legitimate date format
so that the query is evaluating dates and not character strings or

i don't know ASP but you should have some kind of standard date format
function you could apply to view_date before you pass it to the query

if necessary, you could then do a cast/convert on it in the database...

   select * from tblEvents
    where cast(   %???(view_date)???%   as datetime)
          between dteEvStart and dteEvEnd


More information about the thelist mailing list