DTS parameter transfer example
-- 1. Create a test table
Create Table tempdb. DBO. Tb (id int)
-- 2. Create a data transmission package
Create in the package:
A. Microsoft ole db provider for SQL Server connection
B. Execute an SQL task
Write the "SQL statement" of the task: insert TB values (?)
Click "parameter" to open the "parameter ing" dialog box.
Click the "Create global variable" button to create a global variable named value, whose type is integer and whose value is 1.
Click "OK" to return to the "parameter ing" dialog box. In the "parameter ing" list, enter the global variable "select" value "for" parameter 1"
Click "OK" to return to the "DTS package definition" window.
C. Save the DTS package. Set the package name to a and the location to "SQL Server"
-- 3. Create a new package to call Package
Create in the package:
A. Run the Package task
Select the package name a created in step 2 from the package name in the general option
In the "external global variables" option, enter the variable name value. (Corresponding to the global variables in step 2)
B. Save the DTS package. Set the package name to B and the location to "SQL Server"
-- 4. Run the package and view the result.
Exec master. DBO. xp_mongoshell 'dtsrun/S/e/N "B"/a "value": 3 = "2 "'
Exec master. DBO. xp_mongoshell 'dtsrun/S/e/N "B"/a "value": 3 = "3 "'
Exec master. DBO. xp_mongoshell 'dtsrun/S/e/N "B"/a "value": 3 = "5 "'
Exec master. DBO. xp_mongoshell 'dtsrun/S/e/N "B"/a "value": 3 = "10 "'
Select * From tempdb. DBO. TB
Drop table tempdb. DBO. TB
Csdn Community post address