bschwarting
asked on
asp sql syntax - current date- datediff
What's the best way to get the current date in this query instead of the hard coded 10/15/2007?
I've tried a couple scenarios with no luck. <%response.write(date())%> and (date())
conn.open "SELECT id, date1, EmpName, Software, Hardware, Comments, Status, date2, Comments2, Tech, Priority, DATEDIFF('d', date2, '10/15/2007') AS testouput FROM helpdesk WHERE (Status = 'closed') AND (DATEDIFF('d', date2, '10/15/2007') < " & daysback & " ) ORDER BY id DESC;", "DSN=helpdesk"
ideas?
I've tried a couple scenarios with no luck. <%response.write(date())%>
conn.open "SELECT id, date1, EmpName, Software, Hardware, Comments, Status, date2, Comments2, Tech, Priority, DATEDIFF('d', date2, '10/15/2007') AS testouput FROM helpdesk WHERE (Status = 'closed') AND (DATEDIFF('d', date2, '10/15/2007') < " & daysback & " ) ORDER BY id DESC;", "DSN=helpdesk"
ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Date() worked great, thanks!
eg.
DATEDIFF('d', date2, getdate())