spMFGetLicense

Returns
  • 1 = Success

  • -1 = Error

Parameters
@ModuleID nvarchar(10)
  • Module identifier to check

@ExpiryDate datetime (output)
  • Expiry date; returns NULL if not available

@CheckStatus int (output)
  • Pre-check status code

@Status nvarchar(100) (output)
  • Human-readable status text

@Errorcode nvarchar(10) (output)
  • Internal error code, when applicable

@Debug smallint (optional)
  • Default = 0

  • 1 = Standard Debug Mode

Purpose

Internal helper used by the license validation routine spMFCheckLicenseStatus. Executes the module validation and returns an interpreted result set via output parameters.

Examples

 DECLARE @ExpiryDate DATETIME,
   @Errorcode  NVARCHAR(10),
   @CheckStatus INT,
   @Status     NVARCHAR(100);

 EXEC dbo.spMFGetLicense
@ModuleID    = 1,
@ExpiryDate  = @ExpiryDate OUTPUT,
@Errorcode   = @Errorcode OUTPUT,
@CheckStatus = @CheckStatus OUTPUT,
@Status      = @Status OUTPUT,
@Debug       = 0;

 SELECT @ExpiryDate AS ExpiryDate,
  @Errorcode  AS Errorcode,
  @CheckStatus AS CheckStatus,
  @Status     AS Status;

Changelog

Date

Author

Description

2026-07-30

AC

Follow-up to the 2026-07-29 fix below, which made the no-license path reachable for the first time and so exposed two further defects on it: (1) the check-status CASE tested @DaysToExpiry = 0 before @errorCode = ‘4’, so a module with no license at all was reported as “license expired” (7) instead of “no license exist” (8) and the ‘4’ branch was unreachable - the explicit @errorCode branches now evaluate first; (2) the “after validate” debug message concatenated a NULL @ExpiryDate, producing a NULL message text and so a second blank RAISERROR whenever @Debug > 0 - now ISNULL-guarded. Also dropped the meaningless ISNULL(@ExpiryDate,’’) 1900-01-01 rendering from the parse-failure message, which reports the unparseable license text instead.

2026-07-29

AC

Stop raising an empty/malformed error when a module has no license configured (@LicenseExpiryTXT IS NULL). The 2026-04-28 TRY_CONVERT switch made this reachable: the prior hard CONVERT() threw before this point, so this branch’s NULL-concatenation bug (string + NULL license date = NULL message, unchanged since 2022) was rarely hit; TRY_CONVERT returns NULL instead of throwing, so every no-license module now fell into this block and raised a blank RAISERROR instead of the clean @errorCode=4 “no license exist” outcome this procedure already documents and handles downstream. The date- validation error now only fires when license text was present but unparseable – a genuine parse failure – not when there’s simply no license to parse. Surfaced by 5.13.38.82 Stage 40 Test 2.

2026-04-28

LC

use try_convert for date conversion

2025-01-07

LC

add culture check in datetime formatting

2024-12-31

LC

add additional variations of converting datetime for license

2024-12-13

LC

add additional debugging

2024-03-25

LC

add try catch on expriy date conversion to deal with different formats

2024-02-02

LC

remove time from expiry date

2023-09-04

LC

remove try catch block for validating expiry date

2022-02-24

MA

Fix date delimiter bug to pass in fnMFTextToDate funtion

2021-04-08

LC

Add check to validate connection

2021-01-06

LC

Fix bug with checking module 2 license

2020-12-04

LC

Create procedure to aid spMFChecklicense status