dbTalk Databases Forums  

DTS and parameters inside the select clause

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS and parameters inside the select clause in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Scott Lam
 
Posts: n/a

Default DTS and parameters inside the select clause - 08-26-2005 , 12:52 AM






Hi,

I'm trying to create a DTS package using a Transform Data Task using the
following query:
"Select field1, ? from Table1 ". I want to pass a parameter inside my select
query so I can populate the destination with the parameter that I'm passing.

Is it possible to pass a parameter inside a select clause ? Everytime I do,
I get a parse error ?

I created a stored procedure that calls this DTS package thru the DTSRUn
command, I have designed previous DTS and it works if I use the parameters in
the "WHERE" clause.


Thanks,
Scott



Reply With Quote
  #2  
Old   
Aengus
 
Posts: n/a

Default RE: DTS and parameters inside the select clause - 08-26-2005 , 09:06 AM






Try building sql statement within ActiveX script using something like this:

set pkg = DTSGlobalVariables.parent
' Get DataPump CustomTask
Set stp = pkg.Steps("DTSStep_DTSDataPumpTask_1")
Set tsk = pkg.Tasks(stp.TaskName)
set oDataPump = tsk.CustomTask

' Build new SQL Statement
'sSQLStatement = "SELECT * FROM employee WHERE hire_date > '" &
DTSGlobalVariables("FilterDate").Value & "'"





"Scott Lam" wrote:

Quote:
Hi,

I'm trying to create a DTS package using a Transform Data Task using the
following query:
"Select field1, ? from Table1 ". I want to pass a parameter inside my select
query so I can populate the destination with the parameter that I'm passing.

Is it possible to pass a parameter inside a select clause ? Everytime I do,
I get a parse error ?

I created a stored procedure that calls this DTS package thru the DTSRUn
command, I have designed previous DTS and it works if I use the parameters in
the "WHERE" clause.


Thanks,
Scott



Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS and parameters inside the select clause - 08-27-2005 , 03:01 AM



Have a look at this article


Global Variables and SQL statements in DTS
(http://www.sqldts.com/default.aspx?205)




"Scott Lam" <Scott Lam (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,

I'm trying to create a DTS package using a Transform Data Task using the
following query:
"Select field1, ? from Table1 ". I want to pass a parameter inside my
select
query so I can populate the destination with the parameter that I'm
passing.

Is it possible to pass a parameter inside a select clause ? Everytime I
do,
I get a parse error ?

I created a stored procedure that calls this DTS package thru the DTSRUn
command, I have designed previous DTS and it works if I use the parameters
in
the "WHERE" clause.


Thanks,
Scott





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.