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

	SELECT	@CNT = COUNT(*)
	FROM	MIG_USERS
	WHERE	LEN(LN_USER) > 9

	IF @CNT > 0
	BEGIN
		SET @STATUS = 1
		SET @MESSAGE = 'User Names with Length > 9 are detected. Correct them via Pre-Corrections I >> Users Tab.'
	END
	ELSE
	BEGIN
		SET @STATUS = 0
		SET @MESSAGE = ''
	END
	
	SELECT @STATUS, @MESSAGE
END

