June 14, 2019 at 9:46 am
Hi,
I have an ExecSQL task that generates many UPDATE statements which I would like to store as a variable and used in a subsequent ExecSQL statement.
Is this possible? So far I have tried to store the output as a variable but then it fails.
Any help welcome on this.
Thanks,
Eamon
June 14, 2019 at 10:01 am
Do you mean you're generating Dynamic SQL? Where is this variable you are wanting to "store" the dynamic SQL in, SSIS or SQL Server (if the latter, then surely you already have a variable as you're executing dynamic SQL with sp_executesql
). If you do want to store the value in SSIS, do these statements return any other datasets?
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 14, 2019 at 1:48 pm
If you are running some SQL which returns a result set of T-SQL queries, the answer is yes.
Return the result set to an Object variable, which should be shredded within a Foreach container, which itself would contain an ExecuteSQL task whose command would be set from an Expression, to contain the text from the shredded result set.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply