Hi
I am using the custom logging with the use of Execute SQL Tasks (through SQL Source property and expressions) and Event Handlers.
I cannot get the the OnExecStatusChanged event handler to work and after doing some digging around I learned that this event handler does not work properly - https://connect.microsoft.com/SQLServer/feedback/details/553217/ssis-event-onexecstatuschanged
Has anybody had any luck with trying to get the OnExecStatusChanged event handler to work and see what value is exposed through the ExecutionSatus system variable? This is a Boolean datatype system variable to, so what type of value are you going to get back 0/1 or True/False?
The other event handler I am having difficulty with is the OnQueryCancel event handler and using the Cancel system variable, doing some digging around again I find there is an bug associated with this event handler as can be found here - https://connect.microsoft.com/SQLServer/feedback/details/551090/ssis-systemvariable-cancel-in-onerror#details Has anybody got this one to work?
The last one I am having difficulty with is the OnTaskFailed event handler.
This is the SQL Insert statement I have written and entered into the SQLStatementSource property of the Execute SQL Task -
" INSERT INTO log_PkgStgMyTable (
EventLoggedDateTime,
EventType,
EventTaskID,
EventTaskName,
PackageID,
PackageName,
PackageCreationDateTime,
PackageVersionBuild,
PackageCreatedBy,
PackageExecutedBy,
PackageExecutedOnMachine,
PackageExecutionID,
PackageExecutionStartDateTime,
TaskID,
TaskName,
TaskExecutionStartDateTime,
TaskExecutionStatus
)
VALUES (
'"+ SUBSTRING( (DT_WSTR, 29) GETDATE(), 1, 23) +"',
'OnTaskFailed',
'"+ @[System::TaskID] +"',
'"+ @[System::TaskName] +"',
'"+ @[System::PackageID] +"',
'"+ @[System::PackageName] +"',
'"+ (DT_WSTR, 19) @[System::CreationDate] +"',
'"+ (DT_WSTR, 4) @[System::VersionBuild] +"',
'"+ @[System::CreatorName] +"',
'"+ @[System::UserName] +"',
'"+ @[System::MachineName] +"',
'"+ @[System::ExecutionInstanceGUID] +"',
'"+ (DT_WSTR, 19) (DT_DBTIMESTAMP) @[System::StartTime] +"',
'"+ @[System::SourceID] +"',
'"+ @[System::SourceName] +"',
'"+ (DT_WSTR, 19) (DT_DBTIMESTAMP) @[System::ContainerStartTime] +"',
'"+ @[System::ExecutionValue] +"'
)
"
When I try and evaluate this expression I receive the following error message -
The data type of variable "System::ExecutionValue" is not supported in an expression.
Reading the variable "System::ExecutionValue" failed with error code 0xC00470D0.
(Microsoft.DataTransformationServices.Controls)
I know the ExecutionValue is a DBNull datatype but what do I need to do get this working?
The field in my table that will be accepting the value from this system variable is defined as -
[TaskExecutionStatus] [varchar](20) NULL,
If I need to change the datatype of the field above, then please can let someone let me know?
Thank you in advance.