--EXEC MIG_VALIDATE_MAPPING_RULES_OBJ_ID_Sp '', ''
CREATE OR ALTER PROCEDURE MIG_VALIDATE_MAPPING_RULES_OBJ_ID_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 PDM_OBJ_ID NOT IN 
	(
		--'CUSTOMER',
		'DOC',
		'DOC_CLASSIFICATION',
		'DOC_VAULT_HISTORY',
		'EO',
		'FILE',
		'ITEM',
		'ITEM_CLASSIFICATION',
		'ITEM_VAULT_HISTORY',
		--'MANUFACTURERS',
		'PROJECT' --,
		--'SUB_CONTRACTOR',
		--'SUPPLIER'
	)
	AND PDM_OBJ_ID NOT LIKE 'EO_HISTORY %'


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

			SET @MESSAGE = @MESSAGE + 'Mapping Rules found for objects found that are not supported.'
		END

	SELECT @STATUS, @MESSAGE
END

