The following will return a date/time when put in an expression in SSIS.
(DT_STR, 4, 1252)DATEPART("yyyy", @[System::ContainerStartTime]) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mm", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("dd", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("hh", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mi", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("ss", @[System::ContainerStartTime]), 2)
How can I have the SSIS
Return yesterday in SSIS Expression? because my data is yesterday's data (-1)?
Here is the answer:
Right("0" + (DT_STR,4,1252) DatePart("YY",DATEADD("DD",-1,getdate() ) ),4) +
Right("0" + (DT_STR,4,1252) DatePart("MM",DATEADD("DD",-1,getdate() ) ),2) +
Right("0" + (DT_STR,4,1252) DatePart("DD",DATEADD("DD",-1,getdate() ) ),2)