troubleshooting Question

MS SQL -- GetDate(), without -, subtract 7 days ?

Avatar of finance_teacher
finance_teacher asked on
Microsoft SQL ServerMicrosoft SQL Server 2005SQL
2 Comments1 Solution562 ViewsLast Modified:
Below works, but updates to YYYY-MM-DD with DD of 3006 instead of taking 7 days away.

How can I change so it
 1. updates to YYYYMMDD without "-" and
 2. subtracts 7 days ?

update subscriptions
set parameters =
    substring(parameters, 1, 67)  +
    (select CONVERT(char(10), GetDate()-7,126)) + --ORIGINALLY substring(parameters, 68,8)   +
    substring(parameters, 76, 73) +
    (select CONVERT(char(10), GetDate(),126)) + --ORIGINALLY substring(parameters, 149,8)  +
    substring(parameters, 157, 999)
where subscriptionID in
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros