dbTalk Databases Forums  

Using Parameters in "Transform Data Task"

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


Discuss Using Parameters in "Transform Data Task" in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Paco Nassa
 
Posts: n/a

Default Using Parameters in "Transform Data Task" - 09-04-2003 , 12:15 PM






Hi,
i have a question to make.
Is it possible to do the following query in the "Transform
Data Task" Source folder,

SELECT ? FROM TABLE

where the parameter would be a given GlobalVariable.

Thanks,
Paco Nassa

Reply With Quote
  #2  
Old   
J O Holloway
 
Posts: n/a

Default Re: Using Parameters in "Transform Data Task" - 09-04-2003 , 12:45 PM






I'm sure there are other ways to do this, but this is what comes to mind.

First, I'm assuming that your plan is to change the Global Variable each
time.

Second, the whole query must go into the Global Variable string. Whatever
technique you're using to change the GV so that it knows what field to bring
back, use that to throw in the whole query.

Third, precede the first connection (of the Transform Data Task) with a
Dynamic Properties Task, tying them together with an OnSuccess arrow.

Fourth, use that Dyn. Prop. Task to set the SourceSQLStatement property of
the Transform Data Task using that GV.

Now, I know you probably just want to throw in the field of your choice into
that GV, and I'm just not seeing a way to parse the one GV into another so
that the SQL statement can be strung together. Well, of course, you could
do it with a stored procedure, and set one GV to have a SQL string based
what's in another GV. You can do that from a stored procedure by using the
sp_OA* tools, and then call that procedure using an Execute SQL Task prior
to the Dynamic Properties Task.

Best regards.


JOH



"Paco Nassa" <ricardo.silva (AT) link (DOT) pt> wrote

Quote:
Hi,
i have a question to make.
Is it possible to do the following query in the "Transform
Data Task" Source folder,

SELECT ? FROM TABLE

where the parameter would be a given GlobalVariable.

Thanks,
Paco Nassa



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

Default Re: Using Parameters in "Transform Data Task" - 09-05-2003 , 01:42 AM



In addition to JOH's post you can see how to manipulate the statements in
DTS and substitute in Global Variables here

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


Nothe though that your transformations will be expecting the same fieldnames
in the SourceColumns collection. You can get around this by always aliasing
them as the same name

--


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

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.