Rename and Archive a flat file
I have multiple files with names Input_Timestamp. I am using a For each loop containeralong with execute SQL task and data flow task. I created a variable called sFile in the for each loop. I am able to load data from N number of Input files to the table and move it to a different location. But when I try to append timestamp I face difficulty and I am unable to move the file. Need help how to do it?Anand
May 22nd, 2012 6:58am

You can append a timestamp in an expression. How are you trying to move the file? If you are using the FileSystemTask, choose the Rename functionality and create 2 destination variables: @destinationpath and @destinationfilename. The first one will have a fixed value, for example C:\Archive\. The second one will have an expression (set the property EvaluateAsExpression to True): @destinationpath + myFileName + "_"+ REPLACE((DT_WSTR, 10)(DT_DBDATE)GETDATE(), "-","") + REPLACE((DT_WSTR, 10)(DT_DBTIME)GETDATE(), ":","") + ".txt" MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 7:11am

You can append a timestamp in an expression. How are you trying to move the file? If you are using the FileSystemTask, choose the Rename functionality and create 2 destination variables: @destinationpath and @destinationfilename. The first one will have a fixed value, for example C:\Archive\. The second one will have an expression (set the property EvaluateAsExpression to True): @destinationpath + myFileName + "_"+ REPLACE((DT_WSTR, 10)(DT_DBDATE)GETDATE(), "-","") + REPLACE((DT_WSTR, 10)(DT_DBTIME)GETDATE(), ":","") + ".txt" MCTS, MCITP - Please mark posts as answered where appropriate.
May 22nd, 2012 7:20am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics