The document provides an overview of tasks in SQL Server Integration Services (SSIS), including the FTP task and Script task. It discusses the purposes and configuration of the FTP task for transferring files between local and remote locations. It also covers how the Script task allows custom code to perform functions not available in other SSIS tasks, and how to configure and write scripts for the Script task.
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Microsoft Data Platform MVP Kiki Rizki Noviandi Shares SSIS Tasks and Scripting Best Practices
1.
2. Microsoft Data Platform MVP Since
2006
Founder SQL Server Indonesia User
Group Community
About Me
My Name : Kiki Rizki Noviandi
Milis : sqlserver-indo@yahoogroups.com
https://www.facebook.com/groups/sqlserverindonesiahttp://www.kwad5.com
https://mvp.microsoft.com/en-us/PublicProfile/33869?fullName=Kiki%20Rizki%20Noviandi
5. Overview : SSIS Task
• Tasks are control flow elements that define units of work that are
performed in a package control flow
• SQL Server Integration Services package is made up of one or more
tasks. If the package contains more than one task, they are connected
and sequenced in the control flow by precedence constraints.
• The SSIS Designer, the graphical tool in SQL Server Integration
Services for working with packages, provides the design surface for
creating package control flow, and provides custom editors for
configuring tasks
6. Type Of Task
Integration Services includes the following types of tasks.
• Data Flow Task
• Data Preparation Tasks
• Workflow Tasks
• SQL Server Tasks
• Scripting Tasks
• FTP Task
• Analysis Services Tasks
• Maintenance Tasks
• Custom Tasks
7. Add or Delete a Task or a Container in a
Control Flow
Add
• In Solution Explorer, double-click the package to
open it.
• Click the Control Flow tab.
• To open the Toolbox, click Toolbox on the View
menu.
• Expand Control Flow Items and Maintenance
Tasks.
• Drag tasks and containers from the Toolbox to the
design surface of the Control Flow tab.
• Connect a task or container within the package
control flow by dragging its connector to another
component in the control flow
Delete
• In Solution Explorer, double-click the package to
open it. Do one of the following:
• Click the Control Flow tab, right-click the task or
container that you want to remove, and then click
Delete.
• Open Package Explorer. From the Executables
folder, right-click the task or container that you
want to remove, and then click Delete.
• To save the updated package, click Save Selected
Items on the File menu.
8. Set The Properties of Task Or Container
• In SQL Server Data Tools (SSDT), open the Integration Services project that contains
the package you want.
• In Solution Explorer, double-click the package to open it.
• Click the Control Flow tab.
• On the design surface of the Control Flow tab, right-click the task or container, and
then click Properties.
• In the Properties window, update the property value.
• Optionally, create property expressions to dynamically update the properties of
the task or container. For more information, see Add or Change a Property
Expression.
• To save the updated package, click Save Selected Items on the File menu.
11. What’s FTP Task
• The FTP task downloads and uploads data files and manages
directories on servers, The FTP task downloads and uploads data files
and manages directories on servers.
• You can use the FTP task for the following purposes
• Copying directories and data files from one directory to another
• Logging in to a source FTP location and copying files or packages to a
destination directory.
• Downloading files from an FTP location and applying transformations to
column data before loading the data into a database.
13. FTP Task Editor (General Page)
• Use the General page of the FTP Task Editor dialog box to specify the
FTP connection manager that connects to the FTP server that the task
communicates with. You can also name and describe the FTP task
Option
• FtpConnection
Select an existing FTP connection manager,
or click <New connection...> to create a
connection manager
• StopOnFailure
Indicate whether the FTP task terminates if
an FTP operation fails
• Name
Provide a unique name for the FTP task. This
name is used as the label in the task icon
14. FTP Task Editor (File Transfer Page)
• Use the File Transfer page of the FTP Task Editor dialog box to
configure the FTP operation that the task performs
Local Parameter
IsLocalPathVariable
Indicate whether the local path is stored in a
variable. This property has the options listed in the
following table.
LocalPath
Select an existing File connection manager, or click
<New connection...> to create a connection
manager
15. FTP Task Editor (File Transfer Page) Cont..
Operation
• Select the FTP operation to
perform. This property has the
options listed in the following
table
16. FTP Task Editor (File Transfer Page) Cont..
• IsTransferASCII
Indicate whether files transferred to and from the
remote FTP server should be transferred in ASCII
mode
• Remote Parameters
• IsRemotePathVariable = True
RemoteVariable
Select an existing user-defined variable, or click <New
variable...> to create a user-defined variable.
• IsRemotePathVariable = False
RemotePath
Select an existing FTP connection manager, or click
<New connection...> to create a connection manager.
• OverwriteFileAtDestination
Specify whether a file at the destination can be
overwritten.
17. FTP Connection Manager
• An FTP connection manager enables
a package to connect to a File
Transfer Protocol (FTP) server. The
FTP task that SQL Server Integration
Services includes uses this
connection manager.
• Specify a server name and server port.
• Specify anonymous access, or provide a
user name and a password for basic
authentication.
• Set the time-out, number of retries, and
the amount of data to copy at a time.
• Indicate whether the FTP connection
manager uses passive or active mode.
20. Script Task
• Provides code to perform functions that are not available in the built-
in tasks and transformations that SQL Server Integration Services
provides.
• Combine functions in one script instead of using multiple tasks and
transformations.
• Use the Script task for work that must be done once in a package (or
once per enumerated object), instead than once per data row
21. Purposes Of Script Task
Access data by using other
technologies that are not
supported by built-in
connection types.
• For example, a script can use
Active Directory Service
Interfaces (ADSI) to access
and extract user names from
Active Directory.
Create a package-specific
performance counter.
• For example, a script can
create a performance counter
that is updated while a
complex or poorly performing
task runs.
Identify whether specified files
are empty or how many rows
they contain, and then based
on that information affect the
control flow in a package.
• For example, if a file contains
zero rows, the value of a
variable set to 0, and a
precedence constraint that
evaluates the value prevents
a File System task from
copying the file.
You can use the Script task for the following purposes:
22. Configuring the Script Task in the Script Task
Editor
• General Page of the Script Task
Editor
• On the General page of the Script
Task Editor, you assign a unique
name and a description for the
Script task.
23. Configuring the Script Task in the Script Task
Editor
• Script Page of the Script Task Editor
• ScriptLanguage, Microsoft Visual Studio Tools for
Applications (VSTA) supports the Microsoft Visual
Basic or Microsoft Visual C# programming languages.
• EntryPoint Property, Specifies the method on
the ScriptMain class in the VSTA project that the
Integration Services runtime calls as the entry point
into the Script task code. The ScriptMain class is the
default class generated by the script templates
• ReadOnlyVariables and ReadWriteVariables, You ou
can enter comma-delimited lists of existing variables
as the values of these properties to make the
variables available for read-only or read/write access
within the Script task code.
Edit Script Button
The Edit Script button launches the VSTA development environment
which you write your custom script
24. Expressions Page of the Script Task Editor
• On the Expressions page of the Script Task Editor,
you can use expressions to provide values for the
properties of the Script task listed above and for
many other task properties.
25. Writing and Running the Script that the Task
Uses
• The Script task uses Microsoft Visual Studio Tools for Applications
(VSTA) as the environment in which you write the scripts and the
engine that runs th
• VSTA installed on the computer where the package runs.
• When the package runs, the task loads the script engine and runs the script.
• You can access external .NET assemblies in scripts by adding references to the
assemblies in the project.
26. Edit Script
Edit Script Button
The Edit Script button launches the VSTA development environment in
which you write your custom script
27. Edit Script
Edit Script Button
The Edit Script button launches the VSTA development environment in
which you write your custom script