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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
You can use...

purgedatabeforedate getdate()

Open in new window


Saurabh...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
purgedatabeforedate GETDATE()

Open in new window

0
Lee SavidgeCommented:
If that is a stored procedure, what data type does it take? A string or a datetime?
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Qlemo"Batchelor", 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 ...
0
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()
0
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. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.