小弟请教下,创建SQL的DTS包时候,需要执行的SQL语句能不能带参数? 最好能用存储过程执行的时候传参数,我想向DTS包里传几个必要的不能确定的参数,请问可不可以这样做?该如何做?最好有现成的执行代码!!!!!!!
急啊,各位大虾快帮帮我
[此贴子已经被作者于2006-4-18 10:50:55编辑过]
Parameterized queries are SQL queries written for reusability. They contain parameter markers as placeholders for data that will change from execution to execution. In the Data Transformation Services (DTS) tasks that use parameterized queries, the placeholder syntax is a question mark. The following is an example of a parameterized query:
INSERT INTO Account (CustomerID, CompanyName) VALUES (?, ?)
The following DTS tasks make use of parameterized queries:
Lookup queries, which you can include in Microsoft® ActiveX® script transformations in a Data Driven Query or Transform Data task, make use of parameters to retrieve information from an additional connection. For more information, see Lookup Queries.
All the tasks above can execute SQL queries written with parameters if the source that the query is running against supports it. You can map variables into the SQL parameters. The Data Driven Query task can bring in data from a text file, global variable, or the source data as input to its parameter set. The Transform Data task can use only global variables as input to source data queries. Lookup queries can use data from a text file, global variable, or other source data fields as input. However, the Execute SQL task can use only global variables as input to its parameterized queries. For more information, see Data Driven Query Task, Transform Data Task, and Lookup Queries.
The Execute SQL task can save the results of a query to a global variable. You can use the task to save the data in several formats. For more information about these formats, see Execute SQL Task.
The Transform Data and Data Driven Query tasks can save query results into a table destination column, or a variable. You can also save data to an array when using a Lookup query.