简体   繁体   中英

File not Moved from one directory to another when SSIS Package is scheduled from task scheduler

I am developing a SSIS package with Package deployment model on SQL Server 2016 environment. I have a File Move functionality which is running fine from Visual studio and also when it is run manually from command prompt using below command

"C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\DTExec.exe" /F "D:\project\Package1.dtsx"

When the same is schedules from Task scheduler Files are not moved from one folder to another on the same system.

initially I used File System Task which also behaved as explained above. later I replaced it using Script task and wrote below line of code. Still it is not working.

        try
        {
            System.IO.File.Move(Convert.ToString(Dts.Variables["User::FileName"].Value), Convert.ToString(Dts.Variables["User::ProcessFolder"].Value));
        }
        catch (Exception)
        {


        }

I'm having the same problem. I'd love to log the exception. In my case, there is no exception. The task runs to successful completion (at least that's what the output says). But, no file is moved, no log files created. Everything looks normal in the logs and reports I can see.

I found two things, not sure which one fixed it. Make sure the script task has the same platform target (32 vs 64 bit) as the server. Per: SSIS is executing successfully, but it doesn't seem to be running the script task portion

1) Edit Script

2) Right click the c# project name that looks like a GUID and choose properties

3) Select the Build menu on the left side of the properties page

4) Set the Platform target = x86

I also made sure the target in the Data Tools matches the server version. In developer setup:

1) Right click the project and select Properties

2) Under Configuration Properties select General

3) Set the TargetServerVersion to your target SQL server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM