How to save row values into global variables (Enterprise Manager)
To save row values into global variables
- From the Connection toolbar, drag a Microsoft® OLE DB Provider for SQL Server connection to the Data Transformation Services (DTS) design sheet.
- In the Connection Properties dialog box, in the Database list, click pubs.
- From the Task toolbar, drag an Execute SQL task to the design sheet.
- In the Execute SQL Task Properties dialog box, in the Existing connection list, click the pubs connection just created.
- In the SQL statement box, type the SQL code. For example:
SELECT * FROM titleauthor WHERE (royaltyper = '40')
- Click Parameters, click Create Global Variables, and then enter the global variable names. For example: o_au_id, o_title_id, o_au_order, and o_royaltyper.
- Click the Output Parameters tab, click Row Value, and in the Output Global Variables column, click a row and select the global variable from the list to hold the column's data.
You can skip a column when saving values to a global variable. For example, if you do not want to store the value of the title_id column, modify the Output Global Variable column to assign the title_id column to <none>.
Note If the package has been executed and a value previously returned into the o_title_id global variable, setting the title_id column to <none> will not reset or null the value of o_title_id. The global variable will contain the last value to which it was set. For more information, see Using Global Variables with DTS Packages.