![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
I don't want to change anything in my DTS when moving from DEV to UAT to PROD. So, I have an activeX script (see below) at the start of my DTS that looks for a DTS.ini file in the same folder, gets the path & then sets the SourceIniFileFileName. - this works fine when the DTS is executed within Enterprise Manager. Howevere it fails when I attempte to exceute via dtsrun from a batch file. Any ideas? Thanks, Aengus Function Main() set pkg = DTSGlobalVariables.parent dim custask dim assign dim assign1 'Get reference to the task we want to modify set custask = pkg.Tasks("DTSTask_DTSDynamicPropertiesTask_1").Cu stomtask 'get the path of the .ini file set fso = createobject("scripting.filesystemobject") if fso.FileExists("LRMDTS.ini") then set objFile = fso.GetFile("LRMDTS.ini") strIniFilePath = objFile.Path ' get a reference to the collection of Dynamic properties assignments set assign = custask.Assignments ' loop through assignment for each assign1 in assign If assign1.SourceType = DTSDynamicPropertiesSourceType_IniFile Then assign1.SourceIniFileFileName = strIniFilePath End If next end if set assign = nothing set custask = nothing set pkg = nothing Main = DTSTaskExecResult_Success End Function |
#4
| |||
| |||
|
|
What error do you get ? How to add a Dynamic Properties task to a package and manipulate it using VB. (http://www.sqldts.com/default.aspx?252) "Aengus" <Aengus (AT) discussions (DOT) microsoft.com> wrote in message news:83F62F8C-1890-4C4D-BE9E-DE8404827D2A (AT) microsoft (DOT) com... I don't want to change anything in my DTS when moving from DEV to UAT to PROD. So, I have an activeX script (see below) at the start of my DTS that looks for a DTS.ini file in the same folder, gets the path & then sets the SourceIniFileFileName. - this works fine when the DTS is executed within Enterprise Manager. Howevere it fails when I attempte to exceute via dtsrun from a batch file. Any ideas? Thanks, Aengus Function Main() set pkg = DTSGlobalVariables.parent dim custask dim assign dim assign1 'Get reference to the task we want to modify set custask = pkg.Tasks("DTSTask_DTSDynamicPropertiesTask_1").Cu stomtask 'get the path of the .ini file set fso = createobject("scripting.filesystemobject") if fso.FileExists("LRMDTS.ini") then set objFile = fso.GetFile("LRMDTS.ini") strIniFilePath = objFile.Path ' get a reference to the collection of Dynamic properties assignments set assign = custask.Assignments ' loop through assignment for each assign1 in assign If assign1.SourceType = DTSDynamicPropertiesSourceType_IniFile Then assign1.SourceIniFileFileName = strIniFilePath End If next end if set assign = nothing set custask = nothing set pkg = nothing Main = DTSTaskExecResult_Success End Function |
![]() |
| Thread Tools | |
| Display Modes | |
| |