1

I am trying to get and store in a variable a value from the E1 column in an excel sheet with an execute SQL task like this:

Excel File

enter image description here

However I am getting the error:

Unsupported data type on result set binding 0.

enter image description here

I set up the variable as String.

any suggestion?

Hadi
  • 36,233
  • 13
  • 65
  • 124
Pablo Gûereca
  • 725
  • 1
  • 9
  • 23
  • since you have a scrip task, why don't you just try to fetch that value using a different method in code, and by pass the execute sql task – O. Gungor Nov 28 '17 at 22:30

1 Answers1

1

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:

Hadi
  • 36,233
  • 13
  • 65
  • 124