﻿USE [FabApprovalSystem]
GO
	/****** Object:  StoredProcedure [dbo].[MRBGetMRBHoldLots]    Script Date: 11/21/2024 11:29:05 AM ******/
SET
	ANSI_NULLS ON
GO
SET
	QUOTED_IDENTIFIER ON
GO
	CREATE PROCEDURE [dbo].[MRBGetMRBHoldLots] @MRBNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
SET
	NOCOUNT ON;

SELECT
	AddRemoveChangeMRBFlag + '~' + LotNumber + '~' + CONVERT(CHAR(4), MRBNumber) + '_' + CONVERT(CHAR(3), ISNULL(DispoType, '')) + '    ~'
FROM
	MRBLotsToBeSentToSPN
WHERE
	MRBNumber = @MRBNumber
	AND IsDirty = 1
ORDER BY
	AddRemoveChangeMRBFlag DESC -- the ORDER BY clause is Important for the SPN to process the MRB Flags
END
GO