declare @retailstoreid varchar(18);
set @retailstoreid = 'S1224';
update stra.itempricechange
set integrationStatus = 'A'
where itempricechangeid in (
select itempricechangeid from stra.itempricechange
where itemid not in (select itemid from tm.taskitem where taskid > (select MIN(taskid) from tm.task where pricechangedate > GETDATE() - 1 and actionid = 14 and retailstoreid = @retailstoreid) and retailstoreid = @retailstoreid and actionid = 14)
and pricechangedate > getdate() - 1
and isemergencialtask = 0
and retailstoreid = @retailstoreid)
truncate table stra.itempricechangecontrol
USE [MRS_InStore_GPA_PLT]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[PriceChangeIntegrationProcess]
SELECT 'Return Value' = @return_value
GO