I'm running an SSIS package and I want to set the value of a desired variable during runtime. Here an example
variable1= 1145554478 nvarchar(30)
I'm using nvarchar since I'm adding more characters to the string.
variable2= [ + variable1 + _S]
variable1
and variable2
are package variables.
I've searched for ways to set a value to the variables during runtime. As I thought, it seems that it could be done with an SQL Task Editor. So, I created one. Set the variable1
as imput value, and ResultSet
to single row, and set it to variable2.
then in the code I wrote
set Variable2 = '[' + ? + '_S]'
It's not working, here's the error
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "set Variable2 = '[' + ? + '_S]'" failed with the following error: "Line 1: Incorrect syntax near '='.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. Task failed: Execute SQL Task.
Is a SQL Task editor the best way of setting a variable during runtime?
I think the code I wrote in the Task editor is wrong, since the code in there is not always the same ordinary SQL used regularly.