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 >> business intelligence >> Using The File System Task in SQL ...

Using The File System Task in SQL Server 2008 Integration Services

By : Ashish Kumar Mehta
Mar 23, 2009


SQL Server Integration Services (SSIS) is a Business Intelligence tool which can be used by database developers or administrators to perform extract transform & load (ETL) operations. In my previous article entitled Container Tasks in SQL Server 2008 Integration Services I discussed the different types of container tasks such as For Loop Container, Foreach Loop Container, Task Host and Sequence Container and how they can be used by database developers. In this article I will examine the use of the File System Task which is available in SQL Server 2005 and later versions of Integration Services.

Overview of Data Preparation Tasks in SSIS 2005 & Later Versions

The data preparation tasks within SSIS can be used to retrieve data or to validate the quality of data. The different types of data preparation tasks which are available in SSIS are the File System Task, FTP Task, Web Service Task, XML Task and Data Profiling Task.

Overview of the File System Task

The File System Task can be used to perform different types of operations on files and directories such as create, move, delete, and also to set the attributes for files and folders. The different types of operations which can be performed by the File System tasks are shown in the below snippet.

· Copy Directory can be used to copy all the files from one directory to another. You will need to configure both the source and destination directories when using this operation of the File System task.

· Copy File can be used to copy a file from one location to another location. You will need to configure both the source and destination when using this operation of the File System task.

· Create Directory can be used to create a folder. You will need to specify the source location where the folder needs to be created.

· Delete Directory can be used to delete a folder from a specified location. You will need to specify the source location from where the folder needs to be dropped.

· Delete Directory Content can be used to delete all the files available within the user specified directory.

· Delete File can be used to delete a user specified file from the specified folder.

· Move Directory can be used to move a folder/directory from one location to another location.

· Move File can be used to move a file from one location to another.

· Rename File can be used to rename a file available within a specified location.

· Set Attributes can be used to set attributes to files and folders. Different types of attributes which can be set are hidden, archive, read only and system.

One important point to note is that the File System Task can operate on a single file or a directory at a time, so if you want to perform an operation on multiple tasks you will need to run this task within a Foreach Loop container.

Example – File System Task

We will run through an example using the File System task to copy MDF and LDF files of the Resource Database from the “C:\DDBackups\SystemDatabaseBackups” folder to the“C:\DBBackups\SystemDatabaseBackups\ResourceDB” folder. Once the files are copied we will be setting the attributes of ResourceDB folder to ReadOnly. For more info on the Resource database which is available in SQL Server 2005 and later version you can refer to my previous article entitled Importance of the Resource Database  

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

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

3.       Add variables named ResourceDB_MDF_File, ResourceDB_LDF_File and DestinationDirectory, you can open up the Variables window by right clicking within the control flow design window and by choosing the Variables option from the drop down list as shown in the below snippet.


4.       Once the   Variables window opens up, click on Add Variable button and provide the details as shown in the below snippet.



5.       Drag and drop “File System Task” from the toolbox to the Control Flow window and rename it “Copy ResourceDB MDF File”. Then double click the File System Task to open up the editor window as shown in the below snippet.

The File System Task Editor should be configured with the details shown in the below table.

Destination Connection

IsDestinationPathVariable

True

DestinationVariable

User::DestinationDirectory

(Choose the user variable from the Drop-down list)

OverwriteDestination

True

General

Name

Copy ResourceDB MDF File

Description

File System Task

Operation

Operation

Copy file (Choose this option from the Drop-down list)

Source Connection

IsSourcePathVariable

True

SourceVariable

User::ResourceDB_MDF_File

(Choose the user variable from the Drop-down list)


    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