dbTalk Databases Forums  

[SSIS] Loop through code on multiple servers, skipping those that aredown?

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


Discuss [SSIS] Loop through code on multiple servers, skipping those that aredown? in the microsoft.public.sqlserver.dts forum.



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

Default [SSIS] Loop through code on multiple servers, skipping those that aredown? - 10-16-2009 , 09:14 AM






We're trying to build an SSIS package that will take a list of
servers, connect to each & run code.

However, if a server is down for whatever reason, the task fails.

What we'd like to do is make some sort of note in a table, skip that
server and go on to the next.

Any suggestions? Many thanks.

Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: [SSIS] Loop through code on multiple servers, skipping those that - 10-20-2009 , 08:21 AM






You will need a location that is ALWAYS available, like maybe a flat file on
a file server. Set up a table that lists two columns: Servername and Status.

Set up a Data FLow that queries this 'control' table with something like:
SELECT ServerName FROM ControlTable
WHERE Status = 'Active'

Send that to a Recordset Destination (connected to an Object type variable).

Enclose your code with a For Each loop on the Control Flow, downstream of
the Data Flow above. Set the Foreach ADO Enumerator, and loop over Records in
a Table. Use the Variable Mapping page to map the one ServerName column in
the table to a variable.

Now, for the OLE DB Server Connections, you will need to set up an
Expression that uses the ServerName variable in the ConnectionString
property. Copy the whole string first and paste it into the Expression
Editor, surrounded by Quotes. Then replace the pertinent part with the
Variable.

Example:
"Provider=blah;Server=" + [User::ServerName] + ";Initial Catalog = blah..."

Getting more fancy, you could add a Password column in the Control table,
map it to a Password variable, and edit your string to pass a new password to
each server.

Good luck. Hope this helps.
=====
Todd C


"M Bourgon" wrote:

Quote:
We're trying to build an SSIS package that will take a list of
servers, connect to each & run code.

However, if a server is down for whatever reason, the task fails.

What we'd like to do is make some sort of note in a table, skip that
server and go on to the next.

Any suggestions? Many thanks.
.

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.