Stored Procedures [dbo].[spRecordBatOrStorageError]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inIsStorageProcessingbit1
@inErrorCodeIDint4
@inOrderIDint4
@inSessionIDvarchar(50)50
@inSourceTablevarchar(50)50
@inSourceIDint4
@inObjectTablevarchar(20)20
@inObjectIDint4
@inParam1varchar(128)128
@inParam2varchar(128)128
@inParam3varchar(128)128
@inParam4varchar(128)128
@inParam5varchar(128)128
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/**
*    Records an error to either the BATErrorLog via spBATRecordError or to the StorageErrorLog via spStorageRecordError.
*    The @inIsStorageProcessing parameter controls which way the error is logged.
*
*    To record a BATErrorLog via spBATRecordError, make sure these parameters are populated:
*    =======================================================================================
*    @inIsStorageProcessing = 0 or null (default), since this is normal BAT processing.
*    @inSessionID = The BAT session identifier to use for logging.  For revenue transactions, this is the blank session identifier.
*    @inOrderID = The Orders primary key for the order being processed.
*    @inSourceTable = The name of the source table for this transaction.
*    @inSourceID = The primary key for the source record for this transaction.
*    @inErrorCodeID = The ErrorCode primary key.
*    @inObjectTable = The name of the object table for this transaction.
*    @inObjectID = The primary key for the object record for this transaction.
*    @inParam1 = Optional parameter 1.
*    @inParam2 = Optional parameter 2.
*    @inParam3 = Optional parameter 3.
*    @inParam4 = Optional parameter 4.
*    @inParam5 = Optional parameter 5.
*
*    To record a StorageErrorLog via spStorageRecordError, make sure these parameters are populated:
*    ===============================================================================================
*    @inIsStorageProcessing = 1, since this is storage processing.
*    @inSessionID = The storage session identifier.
*    @inOrderID = The Orders primary key for the order being processed.
*    @inErrorCodeID = The ErrorCode primary key.
*    @inParam1 = Optional parameter 1.
*    @inParam2 = Optional parameter 2.
*    @inParam3 = Optional parameter 3.
*    @inParam4 = Optional parameter 4.
*    @inParam5 = Optional parameter 5.
*
*    Returned Value:
*    ========================================
*    Returns the value returned from the appropriate stored proc:
*    spBATRecordError returns 1
*    spStorageRecordError returns 1.
*/

CREATE PROCEDURE [dbo].[spRecordBatOrStorageError]
    @inIsStorageProcessing bit,
    @inErrorCodeID int,
    @inOrderID int = null,
    @inSessionID varchar(50) = null,
    @inSourceTable varchar(50) = null,
    @inSourceID int = null,
    @inObjectTable varchar(20) = null,
    @inObjectID int = null,
    @inParam1 varchar(128) = null,
    @inParam2 varchar(128) = null,
    @inParam3 varchar(128) = null,
    @inParam4 varchar(128) = null,
    @inParam5 varchar(128) = null
as
set nocount on

declare @theRetValue int

if( isnull( @inIsStorageProcessing, 0 ) = 1 )
begin
    -- This is a storage error to be recorded in StorageErrorLog.
    exec @theRetValue = spStorageRecordError
        @inSessionID = @inSessionID,
        @inOrderID = @inOrderID,
        @inErrorCodeID = @inErrorCodeID,
        @inParam1 = @inParam1,
        @inParam2 = @inParam2,
        @inParam3 = @inParam3,
        @inParam4 = @inParam4,
        @inParam5 = @inParam5
end
else
begin
    -- This is a normal BATProcess error to be recorded in BATErrorLog.
    exec @theRetValue = spBATRecordError
        @inSessionID = @inSessionID,
        @inSourceTable = @inSourceTable,
        @inSourceID = @inSourceID,
        @inErrorCodeID = @inErrorCodeID,
        @inObjectTable = @inObjectTable,
        @inObjectID = @inObjectID,
        @inParam1 = @inParam1,
        @inParam2 = @inParam2,
        @inParam3 = @inParam3,
        @inParam4 = @inParam4,
        @inParam5 = @inParam5
end

return @theRetValue
GO
GRANT EXECUTE ON  [dbo].[spRecordBatOrStorageError] TO [MssExec]
GO
Uses
Used By