--上下两个只有一句差别,但可能导致严重后果。
declare @qiyg varchar(200)
declare @gangkid varchar(50)
declare @count int
set @count=0
declare c_1 cursor local for
select distinct(str_Qiyg) from Pur_QuotePriceDTL
where len(str_Qiyg)>0 --and str_qiyg in (select str_Gangkmc from tran_gangk)
open c_1
fetch next from c_1 into @qiyg
WHILE (@@fetch_status=0)
BEGIN
select @gangkid=str_GangkID from tran_gangk
where str_Gangkywm like @qiyg+'%' or str_Gangkmc like @qiyg+'%'
update Pur_QuotePriceDTL set str_Qiyg = @gangkid,str_Jilxgr=@qiyg,int_jilxgcs=98
where str_Qiyg = @qiyg
set @count=@count+1
print @qiyg+'='+@gangkid
print @count
fetch next from c_1 into @qiyg
end
CLOSE c_1
DEALLOCATE c_1
------------------------------------------------------------------------------
declare @qiyg varchar(200)
declare @gangkid varchar(50)
declare @count int
set @count=0
declare c_1 cursor local for
select distinct(str_Qiyg) from Pur_QuotePriceDTL
where len(str_Qiyg)>0 --and str_qiyg in (select str_Gangkmc from tran_gangk)
open c_1
fetch next from c_1 into @qiyg
WHILE (@@fetch_status=0)
BEGIN
if exists(select 1 from tran_gangk where str_Gangkywm like @qiyg+'%' or str_Gangkmc like @qiyg+'%')
begin
select @gangkid=str_GangkID from tran_gangk
where str_Gangkywm like @qiyg+'%' or str_Gangkmc like @qiyg+'%'
update Pur_QuotePriceDTL set str_Qiyg=@gangkid,str_Jilxgr=@qiyg,int_jilxgcs=98
where str_Qiyg = @qiyg
set @count=@count+1
print @qiyg+'='+@gangkid
print @count
end
fetch next from c_1 into @qiyg
end
CLOSE c_1
DEALLOCATE c_1
浙公网安备 33010602011771号