Dec 302011
 

So I just created a query that will get today’s date dynamically from the database itself, but I’m sure there must be a simpler way of doing it.
the query I’m using now is :


SELECT
count(Incident_ID)
FROM
INCIDENTSM1
WHERE TITLE = 'Password Reset - Windows Login'
AND
CLOSE_TIME > CAST(DATEPART(year,GetDate()) as varchar)+'-'+CAST(DatePart(month,getdate()) as varchar)+'-'+CAST(DatePart(day,getdate()) as varchar)

Just thought I’d throw this out there in case anyone else needs to do something similar in Microsoft SQL.
If anyone has any suggestions on how to improve that query, feel free to post them in the comments.

Share