Friday, February 6, 2015

Put time-stamp in file-name while archiving files thru SSIS

I put this expression for my own reference as sometime I make a mess of it :-((

MyFileName_"+
(DT_STR,4,1252)DATEPART( "yyyy" , @ [System::StartTime] ) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , @[System::StartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , @[System::StartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "hh" , @[System::StartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "mi" , @[System::StartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "ss" , @[System::StartTime] ), 2) +
".txt"

And File Name can also be taken as a variable

FEEDJIT Live Traffic Feed