Discussion:
Execute SQL task error when there is no data
(too old to reply)
Mark
2010-03-08 23:13:01 UTC
Permalink
I have an execute sql task with the following query against adventureworks2008
SELECT description, modifieddate
FROM production.productdescription
WHERE (productdescriptionid = 3)
I set the resultset to a single row.
I add two variable string and datetime to the resultset. When i run it, it
works fine. But if I change the 3 to a 7(data does not exist) it gives me
the SSIS debug host has stopped working message(i am on a 64-bit machine).

How do I capture this, so my task can go on? Better example is if you did
this with for each loop of 1 to 10, 1 and 2 fails, 3 should go through.
Todd C
2010-03-11 13:59:02 UTC
Permalink
So let me understand this:
If your query returns results, those results go into two variables. But it
is possible that it return no rows.

Your Result Mapping is expecting a row, and if it gets no row, it fails.

You don't want it to fail.

As I see it, you can either override ForceExecutionResults and
ForceExecutionValue properties of the task so it always reports Success, or
you can design your query so that it always returns data:

SELECT ISNULL([Field], 'ERROR') AS [Field] ...

then examine the contents of the variable in a precedence constraint
downstream:

@[Variable] == "ERROR"

HTH
--
Todd C
MCTS SQL Server 2005
Post by Mark
I have an execute sql task with the following query against adventureworks2008
SELECT description, modifieddate
FROM production.productdescription
WHERE (productdescriptionid = 3)
I set the resultset to a single row.
I add two variable string and datetime to the resultset. When i run it, it
works fine. But if I change the 3 to a 7(data does not exist) it gives me
the SSIS debug host has stopped working message(i am on a 64-bit machine).
How do I capture this, so my task can go on? Better example is if you did
this with for each loop of 1 to 10, 1 and 2 fails, 3 should go through.
Loading...