2016-09-08 27 views
0

ODBCを使用してデータベースからデータを読み込み、Microsoft.Office.Interopを使用してExcelスプレッドシートを動的に作成するCISコードを使用してSSISスクリプトタスクを作成しました。 Excelオブジェクト。コードは、スプレッドシートをディレクトリフォルダに保存します。SSISパッケージをT-SQLで実行したときにSSISスクリプトタスクが失敗しました

私はSQL Server Business Development Studioでパッケージを実行すると完全に動作し、スプレッドシートは問題なくフォルダに書き込まれますが、T_SQLコードを実行するとスクリプトタスクが失敗します。次のスクリプトタスクコード: -

私はT_SQLコード - を通じて実行すると、それは私がBIツールから直接実行すると、正常に動作しますが、失敗した

@Cmd VARCHAR(4000), 
    @ReturnCode INT, 
    @Msg VARCHAR(1000) 

    SELECT @Cmd = 'DTEXEC /FILE "' + @Path + 'Package.dtsx" /MAXCONCURRENT 1 /CHECKPOINTING OFF /REPORTING EW' 

    EXEC @ReturnCode = xp_cmdshell @Cmd 

エラー: -

Microsoft (R) SQL Server Execute Package Utility Version 12.0.5000.0 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. NULL Started: 12:05:47 PM Error: 2016-09-08 12:05:49.42 Code: 0x00000001 Source: Script Task Description: Exception has been thrown by the target of an invocation. End Error Warning: 2016-09-08 12:05:49.42 Code: 0x80019002 Source: Package Description: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specifie d in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. End Warning DTExec: The package execution returned DTSER_FAILURE (1). Started: 12:05:47 PM Finished: 12:05:49 PM Elapsed: 1.828 seconds NULL

+0

権限の問題へのすべてのポイント?また、xp_cmdshellを有効にして、SQL Serverエージェントを使用してdtsパッケージを起動することも、実際には悪い習慣です。 – Oscar

+0

私は有効な権限を与えていますが、動作していません –

答えて

0

thisと同様の質問です。@ Nick.McDermaidは他の質問を参照しています。similar

彼らは答えoutlined here

A Desktop folder seems to be necessary in the systemprofile folder to open >file by Excel.

This solution is ...

・Windows 2008 Server x64

Please make this folder.

C:\Windows\SysWOW64\config\systemprofile\Desktop

・Windows 2008 Server x86

Please make this folder.

C:\Windows\System32\config\systemprofile\Desktop

This operation took away office automation problems in my system.

関連する問題