dbTalk Databases Forums  

Re: One Script, multiple DB's

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


Discuss Re: One Script, multiple DB's in the microsoft.public.sqlserver.dts forum.



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

Default Re: One Script, multiple DB's - 04-13-2004 , 10:21 AM






I am trying to figure out thehow to get to the connection properties for a Execute SQL task.
I want to change the sql task connection on the fly. Here is what I have

For Each oTask in oPKG.Task

If oTask.CustomTaskID = "DTSExecuteSQLTask" the
----Here is where I am confused. Where do I find reference to the existing connection property in the task
----What is the property to access and change the existing connection of an xecute SQL task? Is there a list of properties -------that an execute SQL task has
msgbox oTask.Properties("Description").valu
----End confusio
' Examine Connection
For Each oConnection in oPKG.Connection
If oConnection.ProviderID = "SQLOLEDB" and oConnection.name = "xxxxxx" The
msgbox oConnection.name & oConnection.datasource & oConnection.descriptio
End I
Nex
End I
Next

Reply With Quote
  #2  
Old   
Ron Sissons
 
Posts: n/a

Default Re: One Script, multiple DB's - 04-13-2004 , 10:37 AM






Better format....

I am trying to figure out the how to get to the connection properties for a
Execute SQL task.
I want to change the sql task connection on the fly. Here is what I have.

For Each oTask in oPKG.Tasks

If oTask.CustomTaskID = "DTSExecuteSQLTask" then
----Here is where I am confused. Where do I find reference to the existing
connection property in the task.
----What is the property to access and change the existing connection of an
xecute SQL task? Is there a list of properties -------that an execute SQL
task has?
msgbox oTask.Properties("Description").value
----End confusion
' Examine Connections
For Each oConnection in oPKG.Connections
If oConnection.ProviderID = "SQLOLEDB" and oConnection.name = "xxxxxx"
Then
msgbox oConnection.name & oConnection.datasource &
oConnection.description
End IF
Next
End IF
Next


Ron Sissons, DBA
Information Technology Services
Riverside County Office of Education
3939 Thirteenth Street, Riverside, CA 92502-0868
Telephone: (909) 826-6471; FAX: [909] 826-6451


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

Default Re: One Script, multiple DB's - 04-13-2004 , 10:44 AM



OK

You want to change the properties of the connection to which your ExecuteSQL
task points.

Does this work for you


Function Main()

dim pkg, con, tsk


'ref to package
set pkg = DTSGlobalVariables.Parent

'Ref to task
set tsk = pkg.Tasks("DTSTask_DTSExecuteSQLTask_1").CustomTas k

'The ConnectionID property of the task is the ID of the Connection

set con = pkg.Connections(tsk.ConnectionID)

'con.DataSource = Server
'con.Catalog = Database


Main = DTSTaskExecResult_Success
End Function


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Rsissons" <rsissons (AT) rcoe (DOT) k12.ca.us> wrote

Quote:
I am trying to figure out thehow to get to the connection properties for a
Execute SQL task.
I want to change the sql task connection on the fly. Here is what I have.

For Each oTask in oPKG.Tasks

If oTask.CustomTaskID = "DTSExecuteSQLTask" then
----Here is where I am confused. Where do I find reference to the existing
connection property in the task.
----What is the property to access and change the existing connection of
an xecute SQL task? Is there a list of properties -------that an execute SQL
task has?
Quote:
msgbox oTask.Properties("Description").value
----End confusion
' Examine Connections
For Each oConnection in oPKG.Connections
If oConnection.ProviderID = "SQLOLEDB" and oConnection.name = "xxxxxx"
Then
msgbox oConnection.name & oConnection.datasource &
oConnection.description
End IF
Next
End IF
Next



Reply With Quote
  #4  
Old   
Ron Sissons
 
Posts: n/a

Default Re: One Script, multiple DB's - 04-13-2004 , 12:05 PM



OK,

I can change the connection that the ExecuteSQL task points to.
Now I want to change it 23 times with different datasource and catalog.
Would the best way be to put all the connection values in a text file and
read them in to change the one connection properties?


Ron Sissons, DBA
Information Technology Services
Riverside County Office of Education
3939 Thirteenth Street, Riverside, CA 92502-0868
Telephone: (909) 826-6471; FAX: [909] 826-6451


Quote:
Allan Mitchell<allan (AT) no-spam (DOT) sqldts.com> 4/13/2004 8:44:13 AM
OK

You want to change the properties of the connection to which your
ExecuteSQL
task points.

Does this work for you


Function Main()

dim pkg, con, tsk


'ref to package
set pkg = DTSGlobalVariables.Parent

'Ref to task
set tsk = pkg.Tasks("DTSTask_DTSExecuteSQLTask_1").CustomTas k

'The ConnectionID property of the task is the ID of the Connection

set con = pkg.Connections(tsk.ConnectionID)

'con.DataSource = Server
'con.Catalog = Database


Main = DTSTaskExecResult_Success
End Function


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Rsissons" <rsissons (AT) rcoe (DOT) k12.ca.us> wrote

Quote:
I am trying to figure out thehow to get to the connection properties for
a
Execute SQL task.
Quote:
I want to change the sql task connection on the fly. Here is what I
have.

For Each oTask in oPKG.Tasks

If oTask.CustomTaskID = "DTSExecuteSQLTask" then
----Here is where I am confused. Where do I find reference to the
existing
connection property in the task.
Quote:
----What is the property to access and change the existing connection of
an xecute SQL task? Is there a list of properties -------that an execute
SQL
task has?
Quote:
msgbox oTask.Properties("Description").value
----End confusion
' Examine Connections
For Each oConnection in oPKG.Connections
If oConnection.ProviderID = "SQLOLEDB" and oConnection.name = "xxxxxx"
Then
msgbox oConnection.name & oConnection.datasource &
oConnection.description
End IF
Next
End IF
Next





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

Default Re: One Script, multiple DB's - 04-13-2004 , 12:40 PM



You certainly can

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

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Ron Sissons" <RSISSONS (AT) rcoe (DOT) k12.ca.us> wrote

Quote:
OK,

I can change the connection that the ExecuteSQL task points to.
Now I want to change it 23 times with different datasource and catalog.
Would the best way be to put all the connection values in a text file and
read them in to change the one connection properties?


Ron Sissons, DBA
Information Technology Services
Riverside County Office of Education
3939 Thirteenth Street, Riverside, CA 92502-0868
Telephone: (909) 826-6471; FAX: [909] 826-6451


Allan Mitchell<allan (AT) no-spam (DOT) sqldts.com> 4/13/2004 8:44:13 AM
OK

You want to change the properties of the connection to which your
ExecuteSQL
task points.

Does this work for you


Function Main()

dim pkg, con, tsk


'ref to package
set pkg = DTSGlobalVariables.Parent

'Ref to task
set tsk = pkg.Tasks("DTSTask_DTSExecuteSQLTask_1").CustomTas k

'The ConnectionID property of the task is the ID of the Connection

set con = pkg.Connections(tsk.ConnectionID)

'con.DataSource = Server
'con.Catalog = Database


Main = DTSTaskExecResult_Success
End Function


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Rsissons" <rsissons (AT) rcoe (DOT) k12.ca.us> wrote in message
news:958DB237-653B-4D74-9221-C1D5D33D25BC (AT) microsoft (DOT) com...
I am trying to figure out thehow to get to the connection properties for
a
Execute SQL task.
I want to change the sql task connection on the fly. Here is what I
have.

For Each oTask in oPKG.Tasks

If oTask.CustomTaskID = "DTSExecuteSQLTask" then
----Here is where I am confused. Where do I find reference to the
existing
connection property in the task.
----What is the property to access and change the existing connection of
an xecute SQL task? Is there a list of properties -------that an execute
SQL
task has?
msgbox oTask.Properties("Description").value
----End confusion
' Examine Connections
For Each oConnection in oPKG.Connections
If oConnection.ProviderID = "SQLOLEDB" and oConnection.name =
"xxxxxx"
Then
msgbox oConnection.name & oConnection.datasource &
oConnection.description
End IF
Next
End IF
Next







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.