all groups > sql server dts > january 2007 >
You're in the

sql server dts

group:

Dynamic Properties Task


Dynamic Properties Task Webtechie
1/25/2007 1:45:00 PM
sql server dts: Hello,

I've created a DTS package that works off a ini file on a server. The
server is a development server. Now I need to move it to QA. I save the
file for the QA folks. I've got an ActiveX script that takes the values out
of the ini file and creates the global variables to run the rest of the
package.

The problem: The dynamic properties task is still looking at the ini file
on the DEV server.

Is there a way to program the dynamic properties to look at the ini file on
the server where the package is being run?

I could always change the values in the dynamic properties task, save it
under a different name as myPackage_QA.dts and deploy this package. However,
I would rather not have multiple copies of the package.

Any thoughts or ideas on a better way?

Thanks,

RE: Dynamic Properties Task RLoski
1/26/2007 6:16:03 AM
This is difficult but doable. I think that if you can just understand the
script below and adjust it to your needs it will work. You are going to
manipulate the dynamic properties task programmatically. This script is
reading an ini file that is called "test.ini" (this is specific to what you
are doing). The path is in the global variable "LogPath." The dynamic
property task assigns the value from test.ini to a global variable called
Message.

First you need to find out what DTS calls the assignment that reads the ini
file. Create and the following script. Watch for the DestinationPropertyID
that makes sense, and copy it verbatum (if you have only one assignment, you
can simplify this script). There may be other ways to get the information
you need. Be creative.

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()
dim file
dim tsk
dim assi

set tsk =
DTSGlobalVariables.Parent.Tasks("DTSTask_DTSDynamicPropertiesTask_1").CustomTask
for each assi in tsk.Assignments
msgbox assi.DestinationPropertyID
next

Main = DTSTaskExecResult_Success
End Function


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Now we are ready for the real script. Where I have "'Global
Variables';'Message';'Properties';'Value'"
put the value you found for the assignment you want to make


VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV


'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()
dim file
dim tsk
dim assi
file = DTSGlobalVariables("LogPath").Value & "\test.ini"

set tsk =
DTSGlobalVariables.Parent.Tasks("DTSTask_DTSDynamicPropertiesTask_1").CustomTask
for each assi in tsk.Assignments
if assi.DestinationPropertyID = "'Global
Variables';'Message';'Properties';'Value'" then
assi.SourceIniFileFileName = file
end if
next

Main = DTSTaskExecResult_Success
End Function



--
Russel Loski, MCSD.Net


[quoted text, click to view]
Re: Dynamic Properties Task JXStern
1/26/2007 7:45:24 PM
Fantastic!

You don't know how much I've wanted this, many, many thanks!

If I may ask, how'd you find this out?

Josh


On Fri, 26 Jan 2007 06:16:03 -0800, RLoski
[quoted text, click to view]
Re: Dynamic Properties Task RLoski
1/26/2007 8:05:00 PM
I did a google search about four months ago. I was too lazy to look for it
again, so I just adapted my code. I set a reference to the DTS libraries in
Access, then use the object explorer to see what other properties I can
manipulate.

I believe that it was from SQLDTS ( this is close:
http://www.sqldts.com/252.aspxwriten by Allan Mitchell). Also,
http://sqlteamdev.cleardata.biz/item.asp?ItemID=12408.

--
Russel Loski, MCSD.Net


[quoted text, click to view]
Re: Dynamic Properties Task JXStern
1/27/2007 11:04:35 AM
Well, thank you Mr. Loski, and Mr. Mitchell!


Guess it's too late for Microsoft to, like, document this, DTS being
obsolete and all, much less expose it to the DTS development
environment.


It's not click-accessible there, somewhere, is it?

I've been in several DTS-heavy shops, and nobody knew this.

Josh


On Fri, 26 Jan 2007 20:05:00 -0800, RLoski
[quoted text, click to view]
AddThis Social Bookmark Button