declare @retailstoreid varchar(18),
@taskId numeric(10,0);
set @retailstoreid = 'S1351';
select @taskid = min(taskid) from tm.task where actionid = 14 and AlertConfigId is not null and PriceChangeDate > getdate() - 1;
update stra.ItemPriceChange
set integrationstatus = 'A' , priceauditintegrationstatus = 'A'
where pricechangedate > getdate() -1
and retailstoreid = @retailstoreid
and itemid not in (select distinct itemid
from tm.taskitem
where taskid >= @taskId
and retailstoreid = @retailstoreid);
select RetailStoreId , ' - ', COUNT(1) from stra.ItemPriceChange where integrationstatus = 'P' and pricechangedate > getdate() -1 group by RetailStoreId
select count(1) from stra.ItemPriceChange where integrationstatus = 'A' and pricechangedate > getdate() -1
exec [dbo].[PriceChangeIntegrationProcess]
exec [dbo].[PriceAuditIntegrationProcess]