UPDATE
rs_current_runtime
SET
processed_date =NULL
WHERE
CORP_PRFT_CTR IN
(SELECT LOC_NUM
FROM RET_LOC_INFO
WHERE LIVE_IN_PRICEBOOK='Y')
GO
WHILE
(SELECTCOUNT(*)FROM rs_current_runtime
WHERE processed_dateISNULL)> 0
BEGIN
DECLARE @CurCorpPrftCtrint
SET @CurCorpPrftCtr=(SELECTMIN(a.corp_prft_ctr)
FROM rs_current_runtime a
WHERE a.processed_dateISNULL
AND a.is_updated=(SELECTMIN(b.is_updated)
FROM rs_current_runtime b
WHERE b.processed_dateISNULL))
EXEC [dbo].[CalculateEffectiveRetail]
@CorpProfitCenter = @CurCorpPrftCtr,
@ProcessPriceChangeRequired
= 1
UPDATE rs_current_runtime
SET processed_date=GETDATE()
WHERE corp_prft_ctr= @CurCorpPrftCtr
END
GO