Appending current date and time to a variable (X) in SSIS, and renaming a file to X_FileName. My issue is, in the same package I will move the file to another folder; when that task comes the X value changes as seconds pass by, and I get error that file name does not exist.
for example, at the time of rename file task the file name will be 20160205_141523_File1.txt and while executing move file task the file name might become 20160205_141544_File1.txt
I am using below code to calculate the new file name
(DT_STR,4,1252) DatePart("yyyy",getdate()) +
Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) +"_"+
Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("n",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("ss",getdate()),2) +"_"+
@[User::FileName]
Thank you for answering.
I resolved this issue by setting the value of the variable at the beginning of the package, using SQL Task.