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

	SELECT	@CNT = COUNT(*)
	FROM	ITEM
	WHERE	OBJECT_TYPE = 74

	IF @CNT > 0
	BEGIN
		SET @STATUS = 1
		SET @MESSAGE = 'Material entries are detected.'
	END
	ELSE
	BEGIN
		SET @STATUS = 0
		SET @MESSAGE = ''
	END
	
	SELECT @STATUS, @MESSAGE
END

