Scripting is one of the most powerful extensibility features in SSIS. It gives developers the ability to extend the native functionality within SSIS to accommodate their specific needs. However, scripting can be difficult to use, and sharing useful scripts across packages and within development teams can be challenging. CodeSlice simplifies this process by providing a step-by-step interface for inserting scripts within packages.
Insert Code Slice Overview
CodeSlice gives users the ability to add Script components and tasks to their SSIS Packages directly from within their development environment.
CodeSlice can be launched by right-clicking anywhere within the design surface of the control or data flow and then selecting Insert Code Slice.
Once CodeSlice has loaded, there are a series of pages that help users configure the slice for their package. These pages change depending on the selected slice. For example, some slices may not require parameters or connection managers. In those cases, the Configure Parameters or Select Connections pages don't display.
|Select Slice||Select the programming language and the slice to configure.|
|Enter Name||Provides the user with options for editing the name, description, and (if applicable) the ability to map an input for data flow transform and destination slices.|
|Configure Parameters||Configure parameters if the selected slice contains parameters.|
|Select Connections||Map existing packages or project connection managers found within the SSIS Package.|
|Configure Variables||Configure the variable(s) available to the code slice.|
Note: Navigate between the CodeSlice pages by selecting Previous or Next on the lower right of each page.
Select the programming language and the slice to configure on the Select Slice page.
Note: Slices available on the Select Slice page are design surface dependent and vary based on the specified design surface.
|Language||The programming language used to generate the script component or task. The following languages are available:|
|Slice||The name of the slice that's used to generate the script component or task.|
|Description||A brief description of the selected slice.|
|Author||The original creator of the selected slice.|
|License||The license agreement that the user agrees to when he or she generates a script using the selected slice.|
Once a slice has been selected, select Next.
Configure the name and description of the Script component, or task, that's generated on the Enter Name page.
|Name||The name of the script component or task that's used once the script generates.|
|Description||A brief description of the selected slice. Changing the description updates the Script component or task's description property once the script generates.|
|Input Mapping||Input mappings are required for some slices. A list of all available data flow outputs is available within the Input Mapping drop-down window.|
|Represents properties that are currently in a valid state.|
|Represents properties that are currently invalid and prevent the user from proceeding further.|
Note: For some data flow slices, users can map a data flow output to the generated script's input.
Once all properties are in a valid state, select Next.
The Configure Parameters page provides a list of all the parameters for the currently selected slice. Type directly into the parameter window, or switch the parameter to be bound to a variable.
You can configure the parameters using direct input or you can switch to having a parameter bound directly to a variable. You can bind either to an existing variable, or create a new variable by selecting New Variable.
|Binds the current parameter directly to a variable within the SSIS Package.|
|Unbinds the current parameter from a variable, reverting the parameter to allow users the ability to directly input values within the generated script.|
|If available, binds the current parameter directly to a connection manager within the SSIS Package.|
|Represents parameters that are currently in a valid state.|
|Represents parameters that are currently invalid and prevent the user from proceeding further.|
Important: Only variables that match the data type for the parameter display within the list of available variables.
Once all parameters are configured, select Next.
If the currently selected slice requires connection manager(s), the Select Connections page providers users the ability to map existing package or project connection managers found within the SSIS Package to the connection managers within the generated script.
Once all connections have been configured, select Next.
The Configure Variables page provides allows the to configure the variable(s) available to the code slice. Variables that were bound to parameters on the Configure Parameters page automatically appear within the list of variables.
Note: Variables appear as Read-only or Read-write based on the parameters they are bound to.
Further customize the script after CodeSlice generates it with more variables. Move variables to the Read-only or Read-write lists by selecting the desired variable and then selecting the appropriate arrow to add or remove them.
Important: Variables that are bound to parameters cannot be removed from the lists of Read-only or Read-write variables. To remove those variables, first remove them from their respective parameter binding.
Once you're satisfied with the variable configurations, select Finish.