spMFProcessBatch_Upsert

Signature

EXEC dbo.spMFProcessBatch_Upsert
    @ProcessBatch_ID = NULL OUTPUT,
    @ProcessType = N'Upsert',
    @LogType = N'Start',
    @LogText = N'',
    @LogStatus = N'Initiate',
    @debug = 0;

Returns

INT: 1 on success; -1 on error.

Parameters

@ProcessBatch_ID
  • Type: INT

  • Required: No (OUTPUT)

  • Description: ProcessBatch logging ID.

@ProcessType
  • Type: NVARCHAR(50)

  • Required: Yes

  • Description: One of Debug, Upsert, Create, Setup, Error.

@LogType
  • Type: NVARCHAR(50)

  • Required: Yes

  • Description: Start or End.

@LogText
  • Type: NVARCHAR(4000)

  • Required: Yes

  • Description: Text message.

@LogStatus
  • Type: NVARCHAR(50)

  • Required: Yes

  • Description: Initiate | In Progress | Partial | Completed | Error.

@debug
  • Type: SMALLINT

  • Required: No (default = 0)

  • Description: 1 = Standard debug; 101 = Advanced debug.

Purpose

Batch multi-function processing with logging.

Examples

DECLARE @ProcessBatch_ID INT = 0;

EXEC [dbo].[spMFProcessBatch_Upsert]
           @ProcessBatch_ID = @ProcessBatch_ID OUTPUT
          ,@ProcessType = 'Test'
          ,@LogText = 'Testing'
          ,@LogStatus = 'Start'
          ,@debug = 1

SELECT * FROM MFProcessBatch WHERE ProcessBatch_ID = @ProcessBatch_ID

WAITFOR DELAY '00:00:02'

EXEC [dbo].[spMFProcessBatch_Upsert]
           @ProcessBatch_ID = @ProcessBatch_ID
          ,@ProcessType = 'Test'
          ,@LogText = 'Testing Complete'
          ,@LogStatus = 'Complete'
          ,@debug = 1

SELECT * FROM MFProcessBatch WHERE ProcessBatch_ID = @ProcessBatch_ID

Changelog

Date

Author

Description

2022-09-30

LC

Reset logtype to include message logging

2022-01-04

LC

Add Assembly logging for app detail logging

2020-03-12

LC

Remove debug text

2019-08-30

JC

Added documentation

2019-01-26

LC

Resolve issues with commits

2019-01-21

LC

Remove unnecessary log entry for dbcc

2018-10-31

LC

Improve debugging comments

2018-08-01

LC

Add debugging