简体   繁体   中英

ssis sql task logging

I have ac# app that calls an SSIS package. I have a listener attached to it so I can capture error and information events and write them to a log. This captures events for dataflow tasks but does not capture anything for the execute SQL tasks. I just want to know when the SQL tasks were executed and if an error occurred. How do I log events for the execute SQL tasks? I made sure that logging was enabled for the SQL tasks in the SSIS package.

I highly recomend this book and the loging framework contained therein:

Microsoft SQL Server 2008 Integration Services: Problem, Design, Solution

ISBN: 978-0-470-52576-0

If I have understood your question correctly I would say it does exactly what you are looking for. Code download link here.

It is very straight forward to set up and quite robust. The authors do an excellent job of walking you through this step by step. Should take you about a day to get it up and running.

I would like to second their recommendation to make a "Template Package" from which you build all other packages. The template has all the SSIS PDS goodies already in it so you only need build those once.

For your reference, here is the table create script for two of the core tables in the SSIS PDS framework:

CREATE TABLE [adm].[PackageTaskLog](
    [PackageTaskLogID] [int] IDENTITY(1,1) NOT NULL,
    [PackageLogID] [int] NOT NULL,
    [SourceName] [varchar](255) NOT NULL,
    [SourceID] [uniqueidentifier] NOT NULL,
    [StartDateTime] [datetime] NOT NULL,
    [EndDateTime] [datetime] NULL,
 CONSTRAINT [PK_PackageTaskLog] PRIMARY KEY CLUSTERED 
(
    [PackageTaskLogID] ASC
)

CREATE TABLE [adm].[PackageErrorLog](
    [PackageErrorLogID] [int] IDENTITY(1,1) NOT NULL,
    [PackageLogID] [int] NOT NULL,
    [SourceName] [varchar](64) NOT NULL,
    [SourceID] [uniqueidentifier] NOT NULL,
    [ErrorCode] [int] NULL,
    [ErrorDescription] [varchar](2000) NULL,
    [LogDateTime] [datetime] NOT NULL,
 CONSTRAINT [PK_PackageErrorLog] PRIMARY KEY CLUSTERED 
(
    [PackageErrorLogID] ASC
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM