ContentContent Recap and Q&A Scripting in Integration Services
◦ Demo: Get the list of names from the SSIS package store Script Task Configuration
◦ Demo: Configuring a Script Task◦ Demo: Sending Email using Script taskLog method◦ Demo: Working with the Log method
Events◦ Demo: Working with the Events Member
Script Components◦ Demo: Creating a Data Transformation Script Component
Summary
@copyright 2014 ([email protected])
Recap and Q&ARecap and Q&A Split and Join Transformations
Demo: Conditional SplitDemo: MulticastDemo: Union AllDemo: MergeDemo: Merge JoinDemo: LookupDemo: Cache
Business Intelligence TransformationsDemo: SCDDemo: Fuzzy GroupingDemo: Term Extraction
Auditing Transformations Demo: Audit Demo: Row count
@copyright 2014 ([email protected])
Scripting in Integration ServicesScripting in Integration Services
Allow to perform administrative tasks programmatically
Allow to extend existing packages with custom logic using ◦ Script task and ◦ Script component.
Perform administrative tasks programmatically using following options:◦ Use the Integration Services object model to manage Integration Services
packages, folders, and roles.◦ Use the Integration Services command prompt utilities, dtexec and dtutil, to run
and manage packages.◦ Use an appropriate task in a package to run a program or batch file.
@copyright 2014 ([email protected])
Managing Integration Services Managing Integration Services Objects with the Object Model.Objects with the Object Model.
Use the object model( especially the properties and methods of the Application class) to perform the following management tasks:◦ To get a list of packages stored in a particular location◦ To determine whether an individual package or folder exists, or to manage the
folders in which packages are stored◦ To get a list of running packages and to stop a running package◦ To get a list of roles that is available on a server or assigned to a package
@copyright 2014 ([email protected])
Command Prompt UtilitiesCommand Prompt Utilities
dtexec utility◦ Used too run an Integration Services package◦ The dtexec utility provides access to all the package configuration and execution
features, such as connections, properties, variables, logging, and progress indicators.
◦ The dtexec utility lets you load packages from three sources: a Microsoft SQL Server database, the SSIS service, and the file system.
dtutil utility◦ Can copy, move, delete, or verify the existence of a package.◦ These actions can be performed on any SSIS package that is stored in one of three
locations: a Microsoft SQL Server database, the SSIS Package Store, and the file system.
◦ The storage type of the package is identified by the /SQL, /FILE, and /DTS options. C:\Users\pram>dtutil /DTS \MSDB\myFolder\conversion /EXISTS C:\Users\pram>dtutil /FILE c:\6_2_DataFlowTransformation.dtsx /DestServer comp_4 /COPY DTS;\MSDB\destpkgname C:\Users\pram>dtutil /DTS \MSDB\destpkgname /DELETE
@copyright 2014 ([email protected])
Script Task ConfigurationScript Task Configuration
Provides code to perform functions that are not available in the built-in tasks and transformations.
If you have to use the script to do the same work for each row of data in a set, you should use the Script component instead of the Script task.
Configuring the Script Task◦ Specify the script language.◦ Optionally, provide lists of read-only and read/write variables for use in the script.◦ Specify the method in the VSTA project that the Integration Services runtime calls
as the entry point into the Script task code.
@copyright 2014 ([email protected])
Log Method(Demo)Log Method(Demo)
The Script task can use the Log method of the Dts object to log user-defined data.◦ Enable logging and ◦ select ScriptTaskLogEntry on the Details tab of the Configure SSIS
Logs dialog box to get it working
@copyright 2014 ([email protected])
Events(Emo)Events(Emo) At run time, executables (packages and Foreach Loop, For Loop, Sequence, and task host containers) raise events
@copyright 2014 ([email protected])
Event handler EventOnError The event handler for the OnError event. This event is raised by an executable when an error occurs.
OnExecStatusChanged
The event handler for the OnExecStatusChanged event. This event is raised by an executable when its execution status changes.
OnInformation The event handler for the OnInformation event. This event is raised during the validation and execution of an executable to report information.
OnPostExecute The event handler for the OnPostExecute event.
OnPostValidate The event handler for the OnPostValidate event. This event is raised by an executable when its validation is finished.
OnPreExecute The event handler for the OnPreExecute event. OnPreValidate The event handler for the OnPreValidate event. OnProgress The event handler for the OnProgress event. This event is raised by an executable when measurable
progress is made by the executable.OnQueryCancel The event handler for the OnQueryCancel event. This event is raised by an executable to determine
whether it should stop running.OnTaskFailed The event handler for the OnTaskFailed event. This event is raised by a task when it fails.OnVariableValueChanged
The event handler for the OnVariableValueChanged event. This event is raised by an executable when the value of a variable changes.
OnWarning The event handler for the OnWarning event. This event is raised by an executable when a warning occurs.
Script Components(Demo)Script Components(Demo) The Script component can be used as a
◦ source, ◦ a transformation,◦ or a destination
You can use the Script component in packages for the following purposes:◦ Apply multiple transformations to data instead of using multiple transformations in
the data flow◦ Access business rules in an existing .NET assembly. For example, a script can
apply a business rule that specifies the range of values that are valid in an Income column.
◦ Use custom formulas and functions◦ Validate column data and skip records that contain invalid dataIf the Script component contains a script that tries to read the
value of a column that is NULL, the Script component fails when you run the package
@copyright 2014 ([email protected])
SummarySummary Scripting in Integration Services
◦ Demo: Get the list of names from the SSIS package store Script Task Configuration
◦ Demo: Configuring a Script Task◦ Demo: Sending Email using Script taskLog method◦ Demo: Working with the Log method
Events◦ Demo: Working with the Events Member
Script Components◦ Demo: Creating a Data Transformation Script Component
@copyright 2014 ([email protected])
DEMO7_Scripts.dtsx 7_SSIS_DailyEmail.dtsx
@copyright 2014 ([email protected])
Resources & QuestionsResources & Questions
Contact me : ◦ [email protected]◦ http://pramodsingla.wordpress.com/
Microsoft Resources:◦ http://technet.microsoft.com/en-us/library/bb522546(v=sql.105).aspx◦ http://www.sqlsafety.com/?p=268
@copyright 2014 ([email protected])
Top Related