ssis - how to set customized variable to system variable

nononame2021 261 Reputation points
2021-12-07T09:47:57.077+00:00

I have added a variable named "failed_msg"

how can I set the value @[System::TaskName] to my new add variable?

I would like to insert error message with task name into ssis log table in case there is failure

how to do that?

I am using visual studio 2012

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,586 Reputation points
    2021-12-07T20:09:11.273+00:00

    Hi @nononame2021 ,

    It is done automatically, i.e. logging, including SSIS Task name.
    You just need to know your execution operation_id value.

    Please see how get that info below.
    It contains lots of useful info: project name, package name, event name, message, etc.
    One column - message_source_name - is a SSIS Task name.

    SQL

    USE SSISDB;  
    GO  
      
    SELECT TOP(1000) *  
    FROM SSISDB.CATALOG.EVENT_MESSAGES  
    WHERE operation_id = 3673  
    	--AND package_name = 'RESTAPI_Calls.dtsx'  
    	--AND [message] LIKE '%:Information:%'  
    	--AND [message] LIKE '%:Error:%'  
    	--AND [message] LIKE '%Fetch%'  
    	--AND [message] LIKE '%"Oracle Destination" wrote%'  
    	--AND event_name IN ('OnError', 'OnWarning')  
    ORDER BY message_time DESC;  
    
    0 comments No comments

  2. ZoeHui-MSFT 41,491 Reputation points
    2021-12-08T06:58:46.263+00:00

    Hi @nononame2021 ,

    You may also refer how-to-query-ssisdb-to-find-out-the-errors-in-the-packages which has provided several codes to find the error in SSMS.

    Hope it will be helpful.

    Regards,

    Zoe


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.