I am getting the below error when I try to insert the system variable values ErrorCode and ErrorDescription into Audit table in Event handling part of SSIS
[Execute SQL Task] Error: Executing the query "INSERT INTO Audit_Backuplog(DatabaseId, Databas..." failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_I4)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
The table has these columns defined as below
ErrorCode NVARCHAR(1000),
ErrorDesc NVARCHAR(2000)
I have the below expression in the exe sql task editor on Onerror event in Event handler
"INSERT INTO Audit_Backuplog(DatabaseId,
DatabaseName,
DatabaseBackUpPath,
BkUpSuccessfull,
BkUpDtTime,
BkUpBy,
PkgComponent,
ErrorCode,
ErrorDesc
)
VALUES
('"+(DT_WSTR,3)(@[User::DatabaseId])+"','"+
@[User::DatabaseName]+"','"+
@[User::DbBkUpPath]+"','No','"+(DT_WSTR,50)@[System::CreationDate]+"','"+
@[System::UserName]+"','"+
@[System::TaskName]+"','"+(DT_WSTR,50)@[System::ErrorCode]+"',RTRIM(LEFT('"+@[System::ErrorDescription]+"',1000)))"
Neil