Wednesday 22 January 2020

[Execute SQL Task] Error: An error occurred while assigning a value to variable "XYZ": "Single Row result set is specified, but no rows were returned."


This error occurred when execute sql task returning the no record and we are trying to store this value into the Single Row Result set.
Let’s see this demo
This is my table
     


And we want to set get the emp number based on the city. I am writing a simple sql script.
 

Now I am taking execute sql task
 

Storing this value into the variable.
Always it will return one record so I am using single row.
Now I am running.


Executed successfully.
It will throw an error, when it will return no record. See below.


Now running the same
 

Failed with below error.
[Execute SQL Task] Error: An error occurred while assigning a value to variable "XYZ": "Single Row result set is specified, but no rows were returned."

To overcome this issue we need to take ResultSets as full result set and store this value into the object type variable.


I am creating an object type of variable.


Now I am running this task.


Task executed successfully.

1 comment:

  1. As reported by Stanford Medical, It is in fact the SINGLE reason women in this country get to live 10 years longer and weigh an average of 19 KG less than us.

    (And realistically, it is not related to genetics or some hard exercise and really, EVERYTHING around "how" they eat.)

    BTW, What I said is "HOW", and not "what"...

    Tap on this link to find out if this short test can help you decipher your real weight loss possibilities

    ReplyDelete

If you have any doubt, please let me know.

Popular Posts