Alter SQL Query

purgedatabeforedate "04-21-2015 02:49 PM"

Open in new window

This query is built into a database, but I always have to change the date and time. I want to alter the query so that the date/time is always NOW. I did try purgedatabeforedate NOW(), but that didn't work.

Any help much appreciated! I did search online, but it's such generic search terms.
LVL 22
Anne TroyEast Coast ManagerAsked:
Who is Participating?
Saurabh Singh TeotiaCommented:
You can use...

purgedatabeforedate getdate()

Open in new window

Vitor MontalvãoMSSQL Senior EngineerCommented:
purgedatabeforedate GETDATE()

Open in new window

Lee SavidgeCommented:
If that is a stored procedure, what data type does it take? A string or a datetime?
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

QlemoBatchelor, Developer and EE Topic AdvisorCommented:
If it is a string, it might require to keep exact that formatting of "mm-dd-yyyy hh:mi PM", so this is indeed important to know ...
Anne TroyEast Coast ManagerAuthor Commented:
Thank you for asking that question Qlemo. I think I have my answer in this line of the stored procedure:

IF @date IS NULL SET @date = GETDATE()
Anne TroyEast Coast ManagerAuthor Commented:
Whatever you think is fine with me. I did your job a long time ago before they had topic advisors. :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.