You can use separate INI files that follow with the DTS package, or you can utilize global variables that are fed by the dtsrun command using the /A switch, or a combination of both. The simplest way we found is to feed the location of the INI file to the package using the /A switch, and then reprogram the Dynamic Properties objects to pick their values from there. Also, here is a more efficient snippet that handles multiple Dynamic Properties objects:
' Loop through package tasks, looking for dynamic
' properties task(s). If the task assignment uses an
' INI file, change the INI file specified to the value
' ASSIGNED IN THE "gvINIpath" GLOBAL VARIABLE.
Option Explicit
Function Main()
dim objPackage
dim objTask
dim objDynTask
dim objAssignment
set objPackage = DTSGlobalVariables.Parent
for each objTask in objPackage.Tasks
if objTask.CustomTaskID = "DTSDynamicPropertiesTask" then
set objDynTask = objTask.CustomTask
for each objAssignment in objDynTask.Assignments
if objAssignment.SourceType = 0 then 'Zero is INI file type
objAssignment.SourceIniFileFilename = DTSGlobalVariables("gvINIpath").Value
end if
next
end if
next
set objPackage = Nothing
set objTask = Nothing
set objDynTask = Nothing
set objAssignment = Nothing
Main = DTSTaskExecResult_Success
End Function
Code is compliments of Chris Brannigan