Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS and parameter in select clause

Status
Not open for further replies.

hanglam

Programmer
Dec 11, 2002
143
US
Hi,

I have a DTS package with a Trasform Data Task with the following query :
"Select field1, ? from table "

"?" being the parameter inside my select clause.

I want to use a parameter inside my select query, is that possible? I want to pass a unique value to the query to be saved to the table I'm populating with the DTS package .

My question is: is it possible to use a parameter inside a query in a DTS package ? if so, how do i do that ?

Thanks,
Hang

PS: I'm calling this DTS packge from a stored procedure thur the dtsrun command.
 
Where is the unique value coming from? Do you mean unique to every record inserted, or the same 'unique' value for every record?

If you aren't fussy about the unique value, why not use an id column in the insert table and let the db generate it.

Based on your example above, I'd do it like this, but I'm not sure it is what you are actually looking for. This will pass the same value to every recort in the set. You could do the same thing in the insert statement to get the same effect.

Declare @var dataype()
SET @var = your unique value

or if the value is already extant and declared in the stored procedure, just use it instead of the new @var

Select field1,@var as field2 From table
 
Hang

If you were using an Execute SQL task you could easily pull this off using parameters.

But because you are using a Transform Data Task, I believe you need to clearly define what the destination file format will look like. You can't do that if the source columns are not being defined until runtime.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top