Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

7\9 SSIS 2008R2_Training - Script Task

410 views

Published on

This PPT explains SSIS script task that exists in SQL Server 2008 R2.

Published in: Data & Analytics
  • Be the first to comment

  • Be the first to like this

7\9 SSIS 2008R2_Training - Script Task

  1. 1. 7.Scripts7.Scripts @copyright 2014 (pramod_singla@yahoo.co.in) . Presented by: Pramod Singla Pramod_singla@yahoo.co.in
  2. 2. 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 task Log 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 (pramod_singla@yahoo.co.in)
  3. 3. Recap and Q&ARecap and Q&A  Split and Join Transformations Demo: Conditional Split Demo: Multicast Demo: Union All Demo: Merge Demo: Merge Join Demo: Lookup Demo: Cache  Business Intelligence Transformations Demo: SCD Demo: Fuzzy Grouping Demo: Term Extraction  Auditing Transformations  Demo: Audit  Demo: Row count @copyright 2014 (pramod_singla@yahoo.co.in)
  4. 4. 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 (pramod_singla@yahoo.co.in)
  5. 5. Managing Integration ServicesManaging 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 (pramod_singla@yahoo.co.in)
  6. 6. 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:Userspram>dtutil /DTS MSDBmyFolderconversion /EXISTS  C:Userspram>dtutil /FILE c:6_2_DataFlowTransformation.dtsx /DestServer comp_4  /COPY DTS;MSDBdestpkgname  C:Userspram>dtutil /DTS MSDBdestpkgname /DELETE @copyright 2014 (pramod_singla@yahoo.co.in)
  7. 7. 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 (pramod_singla@yahoo.co.in)
  8. 8. 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 (pramod_singla@yahoo.co.in)
  9. 9. Events(Emo)Events(Emo)  At run time, executables (packages and Foreach Loop, For Loop, Sequence, and task host containers) raise events @copyright 2014 (pramod_singla@yahoo.co.in) Event handler Event OnError The event handler for the OnError event. This event is raised by an executable when an error occurs. OnExecStatusChange d 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. OnVariableValueChan ged 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.
  10. 10. 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 data If 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 (pramod_singla@yahoo.co.in)
  11. 11. 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 task Log 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 (pramod_singla@yahoo.co.in)
  12. 12. DEMO 7_Scripts.dtsx 7_SSIS_DailyEmail.dtsx
  13. 13. @copyright 2014 (pramod_singla@yahoo.co.in)
  14. 14. Resources & QuestionsResources & Questions Contact me : ◦ Pramod_singla@yahoo.co.in ◦ 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 (pramod_singla@yahoo.co.in)

×