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

	SET @STATUS = 0
	SET @MESSAGE = ''

	SELECT @CNT = COUNT(CATEGORY_ID) 
	FROM CATEGORY_TREE 
	WHERE CATEGORY_ID = '000001' 
	
	IF @CNT = 0
	BEGIN
		SET @STATUS = 1
		SET @MESSAGE = CONCAT(@MESSAGE, 'CategoryID 000001 "Item Classification" not found.')
	END


	SELECT @CNT = COUNT(CATEGORY_ID) 
	FROM CATEGORY_TREE 
	WHERE CATEGORY_ID = '000002' 
	
	IF @CNT = 0
	BEGIN
		SET @STATUS = 1
		SET @MESSAGE = CONCAT(@MESSAGE, 'CategoryID 000002 "Document Classification" not found.')
	END
		

	SELECT @STATUS, @MESSAGE
END


