--第一种
declare @bm varchar(30),@id int,@ye numeric(13,2)
declare sqjexg cursor
for select * from #dbye
open sqjexg
fetch sqjexg into @bm,@id,@ye
while (@@fetch_status=0)
begin
set @id=@id+1
update #temp set SQYE=@ye where 收支ID=@id and SBBM=@bm
fetch sqjexg into @bm,@id,@ye
end
deallocate sqjexg
--第一种
--第二种 对取出的行修改
declare @t varchar(100)
declare @l varchar(100)
set @t=':'
declare sfc cursor for SELECT TJXM from TSFRBHZ
where PCID=@PCID and TJXM like '%(FHH):%'
open sfc
fetch next from sfc into @l
while (@@fetch_status=0)
begin
if charindex(@t,@l)<>0
begin
set @t=stuff(@l,1,charindex(@t,@l),'')
select @t=a.XZMS from SFDJ a where a.YSXZ=ltrim(rtrim(@t))
update TSFRBTJ set TJXM='(FHH):'+@t
where CURRENT OF sfc
end
set @t=':'
fetch next from sfc into @l
end
close sfc
deallocate sfc
--第二种