November 25, 2019 at 9:01 pm
I have an SSIS expression where it appends 20191125155915.xlsx to filename
@[User::FilePath] + "\\" + "DBAFullPro_"+(DT_WSTR,4)YEAR(GETDATE()) + RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2) +RIGHT("0" + (DT_WSTR,2)DAY( GETDATE()), 2)+ RIGHT("0" + (DT_WSTR,2)DATEPART("hh", GETDATE()), 2)+ RIGHT("0" + (DT_WSTR,2)DATEPART("mi", GETDATE()), 2)+RIGHT("0" + (DT_WSTR,2)DATEPART("ss", GETDATE()), 2)+".xlsx"
I am using file system task to rename original file name to _timestamp. Once this is renamed. it will move the renamed file to network share path.
suppose if there is any delay in the process, its not looking for correct file because of seconds. it immediately changing the seconds and package is failing. error - cannot find the file in the path.
is there any way to overcome this?
November 25, 2019 at 9:12 pm
Sure. Create a string variable and use an Expression task to set its value (using the code you pasted).
The rename and move can then reference the variable.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
November 25, 2019 at 9:18 pm
I've also used values like the package StartTime which aren't going to change within a single execution of a package.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 25, 2019 at 9:40 pm
i have a string variable where it holds the datetime stamp value. using the same in move too.
in between rename and move file system task. i have created dummy script task to delay the process for 5 sec. in this case file name datetimestamp changed after the delay process.
Move task is failed as the filename didn't find
November 25, 2019 at 9:59 pm
Please reread my post. I said use an Expression task to set the value of a variable. Once set in this way, the value will remain static.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
November 26, 2019 at 5:02 pm
It didn't worked. I have an excel template where i copy the format from source to destination, once data loaded into the destination file, i am renaming it with file system task as rename file operation
example - the original file name is detailreport.xls , i have renamed that to 001detailreport_20191125.xls.
next task is to move this file to fileshare(network) and same file has to move to archive locally.
for moving to file share i have hardcoded the variable path and used file system task as copy file operation from renamed fiel location to file share location.
next is the same file is moved to archive locally using move file operation. here i am getting confused how i can add hours min and sec to file name that is already moved to both locations?
November 26, 2019 at 5:58 pm
I'm sorry, but I don't know how to write it any more clearly. To summarise:
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply