When using a normal select statement, example SELECT * From blabla
, it doesn't return a Single value (Single row may be used when using aggregate functions).
So you have to Select Full Result Set
and mapp the result to a Variable of type System.Object
.
After that add a script task, select the variable in the ReadOnly Variables, then in the script task, create a variable of type IEnumerable
and assign to it the value of the package variable:
Dim dt = Dts.Variables.Item("User::Result").Value
'Dt(0)(0) will contains the value
Or you can achieve this using a Script Task
instead of Execute SQL Task
, just check my answer here: