troubleshooting Question

SQL Where statment help

Avatar of abarefoot
abarefoot asked on
Microsoft SQL ServerSSRSSQL
4 Comments2 Solutions273 ViewsLast Modified:
The last part of the WHERE needs to be different every month; the numbers behind "N##" correspond to a month.  They need to roll forward each month - the below script is setup for August, but for September, the N09 needs to change to N03; in October, the N10 would change to N04, and so on.   ' NS' doesn't change and is constant.

I've tried CASE, but can't get it to hit multiple fields.  One thought was to use a series of SQL jobs to update a temp table with the proper number series each month.  Another was to build some if/then into SSRS.

update purchase_class
set exclude_from_ranking = 'N', exclude_from_reclassification = 'N', date_last_modified = getdate(), last_maintained_by = 'ABIX_DBA'
where exclude_from_ranking = 'Y' and exclude_from_reclassification = 'Y'
and purchase_class_id in ('N11', 'N12', 'N01', 'N02', 'N09', 'N10', 'NS')
Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
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 2 Answers and 4 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