--EXEC MIG_VALIDATE_MAPPING_TEMPLATE_LENGTH_Sp '', ''
CREATE OR ALTER PROCEDURE MIG_VALIDATE_MAPPING_TEMPLATE_LENGTH_Sp
(
	@STATUS INT = 0 OUT,
	@MESSAGE NVARCHAR(999) = NULL OUT
)
AS 
BEGIN
	DECLARE @CNT INT
	
	SET @STATUS = 0
	SET @MESSAGE = NULL

	SELECT @CNT = COUNT(*)
	FROM MAPPING_RULES 
	WHERE LEN(TEMPLATE) > 50


	IF @CNT > 0
		BEGIN
			SET @STATUS = 1
			IF @MESSAGE IS NULL
				SET @MESSAGE = ''

			SET @MESSAGE = @MESSAGE + 'Mapping Template Name exceeds 50 characters.'
		END

	SELECT @STATUS, @MESSAGE
END

