dbTalk Databases Forums  

Execute SQL task error when there is no data

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Execute SQL task error when there is no data in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark
 
Posts: n/a

Default Execute SQL task error when there is no data - 03-08-2010 , 05:13 PM






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.

Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: Execute SQL task error when there is no data - 03-11-2010 , 07:59 AM






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


"Mark" wrote:

Quote:
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.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.