0
votes

I am creating a SSIS package to copy file from source to destination and then rename it with date and time stamp at destination.

Copy task is working fine but when it comes to rename part of the package I am getting following error.

SSIS package "XYZ.dtsx" starting. Error: 0xC0014054 at Rename Copied File: Failed to lock variable "file name" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

Error: 0xC002F304 at Rename Copied File, File System Task: An error occurred with the following error message: "Failed to lock variable "file name " for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.". ". Error: 0xC0024107 at Rename Copied File: There were errors during task validation. Warning: 0x80019002 at Copy_RenameAirtricityDB: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (5) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. SSIS package "Copy_RenameAirtricityDB (1).dtsx" finished: Failure.

2

2 Answers

3
votes

A straight-forward way to move a file and to avoid the need for dummy source- and destination connections and expressions is to use a script task with:

System.IO.File.Move(Dts.Variables["User::SourceFileName"].Value,Dts.Variables["User::DestinationFileName"].Value);
1
votes

I resolved this by setting both my source & destination connections on the file system task to "IsSourcePathVariable = False". Two new (flat file, in my case) connections were created and the connection strings set equal to my variables. It seems the variable is seen only as a text string when passed to the file system task, rather than a file / folder location