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

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.