dbTalk Databases Forums  

SSIS 2008 Execute SQL Task Error

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


Discuss SSIS 2008 Execute SQL Task Error in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
William E. Booth
 
Posts: n/a

Default SSIS 2008 Execute SQL Task Error - 04-06-2010 , 07:52 AM






Hello all,

I have a execute sql task in a container with other tasks. This is all the task has in it DECLARE @RC int
EXECUTE @RC = TruncateTables

The container has a OnError event handler that sends a email.

How is the best way to handle a error in the stored procedure? I do not seem to be able to get the SQL error code or description.

Thanks in advance for any help.
Bill

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

Default RE: SSIS 2008 Execute SQL Task Error - 04-07-2010 , 06:23 AM






William:
Is "TruncateTables" a stored procdure?

If so, can you write it so that regarless of the outcome, the last statement
is something like:
SELECT @MyError as ErrorNumber, @MyErrorDesc AS ErrorDescription

You would have to examine the @@ERROR system variable constantly and
possible use TRY / CATCH blocks.

Then set your Execute SQL task in SSIS to accept a two-field result set (1
row) and map those two field to two Package Variables.

Question: Is it really that important to know the exact error code and
message inside the package execution? Why not just set the command to
EXEC TruncateTables
and let the native SSIS error handling take care of the rest. Possibly use
logging to your advantage to log all errors.

HTH
--
Todd C
MCTS SQL Server 2005


"William E. Booth" wrote:

Quote:
Hello all,

I have a execute sql task in a container with other tasks. This is all the task has in it DECLARE @RC int
EXECUTE @RC = TruncateTables

The container has a OnError event handler that sends a email.

How is the best way to handle a error in the stored procedure? I do not seem to be able to get the SQL error code or description.

Thanks in advance for any help.
Bill


.

Reply With Quote
  #3  
Old   
William E. Booth
 
Posts: n/a

Default Re: RE: SSIS 2008 Execute SQL Task Error - 04-07-2010 , 07:05 PM



Tod,
Yes it is a stored procedure. Thanks for the suggestion. I guess I just wanted to give a little more info then the task failed that I am getting now. Maybe I will try the try catch block.
Again, thanks for the response.
William

Reply With Quote
  #4  
Old   
William E. Booth
 
Posts: n/a

Default Re: SSIS 2008 Execute SQL Task Error - 04-09-2010 , 05:06 PM



For the archives. The problem was the error description variable did not have enough space allocated so it was not displayed.

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.