dbTalk Databases Forums  

set connection properties dynamically

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


Discuss set connection properties dynamically in the microsoft.public.sqlserver.dts forum.



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

Default set connection properties dynamically - 12-17-2003 , 03:16 PM






In the DTS package I am currently working on, I have to create 3 connections, but their
properties (including server, login, password) have to be decided during run time. What
options do I have to implement such a feature? Do I have to do it programmatically?

Another questions is that I have to import a list of tables (part of the data in each table)
from one sql server to another sql sever. Can I use a loop inside the package to run a task
with different table name as parameter?

I am new to DTS, thanks for any suggestions.

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: set connection properties dynamically - 12-17-2003 , 03:35 PM






In article <15F53730-9CED-4AFF-8834-4C77FBEBB238 (AT) microsoft (DOT) com>, Jeffrey
<anonymous (AT) discussions (DOT) microsoft.com> writes
Quote:
In the DTS package I am currently working on, I have to create 3
connections, but their
properties (including server, login, password) have to be decided
during run time. What
options do I have to implement such a feature? Do I have to do it
programmatically?
You can do this in an ActiveX Script Task e.g
Function Main()

Set oConn = DTSGlobalVariables.Parent.Connections("MyConnName" )
oConn.DataSource = DTSGlobalVariables("Server").Value
oConn.Catalog = DTSGlobalVariables("Database").Value

Set oConn = Nothing

Main = DTSTaskExecResult_Success
End Function

You can use a Dynamic Properties Task to read from a variety of
locations and assign the values to the connection properties.

You can also use a Data Link (Udl) connection where all the connection
information is contained with the Udl file itself.

Depending on how you execute the package you can also manipulate the
connection properties directly from the calling program. A simpler
examples to use DTSRUN and the /A option to pass in global variable
values. These can then be assigned either via an ActiveX Script Task as
above or the Dynamic Properties Task also mentioned above.

Quote:
Another questions is that I have to import a list of tables (part of
the data in each table)
from one sql server to another sql sever. Can I use a loop inside the
package to run a task
with different table name as parameter?
You can drive a look around one or more tasks, from pretty much anything
such as an array or a list or a recordset. The problem comes when the
tables are of different structures as this means the DataPump task needs
to be changed as encapsulated within it is the structural information
about the source and destination columns and the transformation between
them. In this case it would be better to have multiple DataPump tasks,
one for each set of structures.

Some examples of looping-

How to loop through a global variable Rowset
(http://www.sqldts.com/default.aspx?298)

Looping, Importing and Archiving
(http://www.sqldts.com/default.aspx?246)


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



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.