I had to take a vendors sp and it is a mess. So I am calling their sp from within my SQL package. I have to pass in a start date and end date. The day of the week dictates what the dates will be. The 2 different ones are Monday which grabs previous Friday's date. Tuesday grabs Saturday, Sunday, and Monday. All the rest of them just pull the previous day. I had this set up in a new stored proc but that isn't going to work. So I want to add the dates as variables in my SSIS package and pass them into the vendors SP. I have that all working and pulling my data based on just using the previous days data. But now I need to get it set up to work like I had mentioned before based on day of week. Not sure how to do this in Expression Builder.
This is what I did in the stored proc:
SET @begdate = (SELECT CASE WHEN datename(dw, getdate()) = 'Monday' THEN CONVERT(VARCHAR(10), dateadd(d, -((datepart(weekday, getdate()) + 1 + @@DATEFIRST) % 7), getdate()), 110) WHEN datename(dw, getdate()) = 'Tuesday' THEN CONVERT(VARCHAR(10), dateadd(day,datediff(day,3,GETDATE()),0), 110) WHEN datename(dw, getdate()) = 'Wednesday' THEN CONVERT(VARCHAR(10), dateadd(day,datediff(day,1,GETDATE()),0), 110) WHEN datename(dw, getdate()) = 'Thursday' THEN CONVERT(VARCHAR(10), dateadd(day,datediff(day,1,GETDATE()),0), 110) WHEN datename(dw, getdate()) = 'Friday' THEN CONVERT(VARCHAR(10), dateadd(day,datediff(day,1,GETDATE()),0), 110) END)
Help please.