I need to use two variables in my SSIS package, @extract_beg_date
and @extract_end_date
.
How do I set them to behave a certain way? For example, in a stored procedure, it would look like this:
SET @extract_beg_date = CASE WHEN DATEPART(weekday,GETDATE()) = '2'
THEN CAST(CONVERT(VARCHAR(10),GETDATE()-2,101) AS DATETIME)
ELSE CAST(CONVERT(VARCHAR(10),GETDATE()-1,101) AS DATETIME)
END
SET @extract_end_date = CAST(CONVERT(VARCHAR(10),GETDATE(),101) AS DATETIME)
How can I set the variables in the SSIS package without having to use a stored procedure? I want to be able to use it in the SQL Command text like so:
SELECT *
FROM dbo.test_tbl
WHERE [TimeStamp] >= @extract_beg_date and [TimeStamp] < @extract_end_date