dbTalk Databases Forums  

dynamically set location for .ini file in DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss dynamically set location for .ini file in DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Aengus
 
Posts: n/a

Default dynamically set location for .ini file in DTS - 08-26-2005 , 08:52 AM






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


Reply With Quote
  #2  
Old   
Thomas Bradshaw via SQLMonster.com
 
Posts: n/a

Default Re: dynamically set location for .ini file in DTS - 08-26-2005 , 11:25 AM






A possibility is that you're not specifying a complete path to your .INI file.
Therefore the base path is different when running from EM than CommandLine.


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...r-dts/200508/1

Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: dynamically set location for .ini file in DTS - 08-27-2005 , 02:29 AM



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

Quote:
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




Reply With Quote
  #4  
Old   
Aengus
 
Posts: n/a

Default Re: dynamically set location for .ini file in DTS - 08-29-2005 , 04:42 AM



The issue is that I want to set the location of the .ini file to be a
relative path.
i.e. below I am using "LRMDTS.ini" for the filename, as the .ini file is in
the same folder as the DTS Package. We use Autosys to execute our batch
files. (Autosys is a scheduling tool - we are not allowed to use sql
scheduled jobs.) When the batch file is run from Autosys, I get an error in
my Dynamic Properties Task as follows:

DTSRun OnError: DTSStep_DTSDynamicPropertiesTask_1, Error = -2147220501
(800403EB)
Error string: No file name provided.

i.e. the SourceIniFileFileName was not set by the activeX script below


"Allan Mitchell" wrote:

Quote:
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





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.