SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Training
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
SQL Azure
Developer
General DBA
ASP.NET / ADO.NET
SQL Azure

USEFUL SITES :

ASP.NET Tutorials
Windows and SQL Azure Tutorials
Cloud Hosting Magazine
SharePoint Tutorials
Windows Server Help

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server

More     
 
Latest FAQ's

Add Node to A SQL Server failover Cluster failed with invalid ...
SQL Server Destination remote server error
Setting Up Data And Log Files For SQL Server
Will Check Constraints Improve Database Performance?

More     
   
Latest Software Reviews

dbForge Review
Spotlight on ApexSQL Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Data Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Doc 2008

More     

articles >> general dba >> Container Tasks in SQL Server 2008 Integration ...

Container Tasks in SQL Server 2008 Integration Services

By : Ashish Kumar Mehta
Mar 18, 2009

Page 2 / 3

Foreach Loop Container

Use Foreach Loop Container Task to loop through a collection of objects. In SQL Server 2005 and later versions there are 7 different types of Foreach Loop Containers.

1.       Foreach File Enumerator

2.       Foreach ADO Enumerator

3.       Foreach ADO.Net Schema Rowset Enumerator

4.       Foreach Item Enumerator

5.       Foreach Nodelist Enumerator

6.       Foreach From Variable Enumerator

7.       Foreach SMO Enumerator

Example - Foreach File Enumerator

 We will work through an example using the Foreach File Enumerator to move all the system databases related backup files to “C:\DDBackups\SystemDatabaseBackups” folder from “C:\DBBackups” common database backup folder.

 1.       Create a new SQL Server Integration Services Project and rename the default package ForeachFileEnumerator.dtsx

2.       Double click ForeachFileEnumerator.dtsx package to open it up in Design mode.

3.       Add a variable named “DatabaseBackupFiles”; you can open up Variables window by right clicking within the control flow design window and by choosing the Variables option from the drop down list.

4.       Once the variables window is open, click on Add Variable button and provide the details as shown in the below snippet.



5.       Drag and drop “Foreach Loop Container” from the toolbox to the Control Flow window. Double click the for loop container to open up editor window as shown in the below snippet.

Next, you need to set the Enumerator option to Foreach File Enumerator from the drop down list. Then, set the folder property to “C:\DBBAckups” and set the value to “M*.*” for Files. And finally under retrieve file name select “Fully Qualified”.

6.       Within the Variable Mapping Page in the Foreach Loop Container, select the "User::DatabaseBackupFiles" variable which we created initially from the drop-down list and then accept the default value of 0 for the index as shown in the below snippet. Click OK to save the settings.

7.       Next step will be to drag and drop a new File System Task into the Foreach Loop Container. Then, double click the File System Task to open up the File System Task Editor as shown in the below snippet.

Configure the Destination Connection by selecting <New Connection…> from the DestinationConnection property. This opens up the File Connection Manager Editor as shown in the below snippet. In the File Connection Manager Editor window select Existing Folder for Usage Type option and set the folder location to “C:\DDBackups\SystemDatabaseBackups”. Click OK to save the settings.


<< Prev Page     Next Page>>    








C# Help and Tutorials | PHP MySQL Tutorial | Sharepoint Tutorial | Azure Tutorial | Cloud Hosting Magazine | ASP.NET Tutorials | Windows Server Help | Windows Phone Pro | Silverlight Ace | Visual Studio Tutorials | Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | SQL Server Training Videos | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 2010 Jude O'Kelly. All rights reserved