How to save an entire rowset into a global variable (Enterprise Manager)

How to Install SQL Server 2000

How To

How to save an entire rowset into a global variable (Enterprise Manager)

To save an entire result set of a SELECT statement into a global variable using the Execute SQL task

  1. From the Connection toolbar, drag a Microsoft® OLE DB Provider for SQL Server connection to the design sheet.

  2. In the Database list, click pubs.

  3. From the Task toolbar, drag an Execute SQL task to the Data Transformation Services (DTS) design sheet.

  4. In the Execute SQL Properties dialog box, in the Existing connection list, click the pubs connection just created.

  5. In the SQL statement box, type the following:
    SELECT *
    FROM titleauthor
    
  6. Click Parameters, and then click Create Global Variables.

  7. In the Name list, type Authors, and then in the Type list, click <other>. Leave the Value box empty.

  8. Click the Output Parameters tab, click Rowset, and then in the Output Parameter Type list, select the Authors global variable.

    This procedure assigns all records returned from the SELECT statement to be stored in the Authors global variable.