Declare C CURSOR Scroll
FOR
Select Code From CRM_Customer Where ShopCode<>门店编号 and (IsShare='1' Or ICCardNumbers>0)
Open C
Declare @tempCustomerCode nvarchar(100)
Declare @temp int
Set @temp=10000
FETCH NEXT From C INTO @tempCustomerCode
while(@@FETCH_sTATUS=0)
begin
Set @temp =@temp+10
dECLARE @countOfPrice int
SElect @countOfPrice = COUNT(1) From CRM_NegotiatedPrice Where CustomerCode = @tempCustomerCode
IF(@countOfPrice IS NOT NULL and @countOfPrice>0)
Begin
Declare @condition nvarchar(100)
Set @condition = ' CustomerCode='''+@tempCustomerCode+''' '
EXEC SYS_SyncPusHToShop_insert
106,
'CRM_NegotiatedPrice',
'Id',
'*',
@temp,
'Update',
@condition,'','',
10
END
FETCH NEXT From C INTO @tempCustomerCode
end
close c
dEALLOCATE c