BIDS(Microsoft Business Intelligence Development Studio)では、パッケージ構成を使用して変数を初期化する方法はありますか?ユーザー変数を使用するパッケージ内にスクリプトタスクがあります。ユーザー変数はハードコードされています。スクリプトタスクを構成可能にしたいと考えています。パッケージ構成を格納するSQL Serverパッケージ構成テーブルがあります。パッケージ構成でSSIS変数を初期化する
スクリプトタスクコードで変数を初期化したいのですが、それとも変数テーブルで行うことができますか?
変数がVariableNameで、パッケージ構成の構成名が「構成名」の場合の構文は何ですか?
また、パッケージの設定値で変数を初期化することは意味がありますか、パッケージ構成を直接使用する方がよいでしょうか?
これらは、現在のパッケージ構成されている:
これは、変数ウィンドウから次のとおりです。
これは、スクリプトタスクからのコードです:
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.IO
Public Class ScriptMain
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.
Public Sub Main()
'
' Add your code here
'
Dim fileName As String
fileName = CStr(Dts.Variables("User::TrialBalanceReportDirectory").Value) + _
CStr(Dts.Variables("User::Slash").Value) + _
CStr(Dts.Variables("User::TrialBalanceReportFile").Value)
'MsgBox(fileName)
Dts.Variables("TrialBalanceReportExists").Value = File.Exists(fileName)
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
ありがとう!
michaelc35