--创建一个存储过程来计算就行了.
create proc p_calc
as
declare @s varchar(8000)
declare tb cursor for select s='update 表 set mon=('+bb+') where id='+cast(id as varchar) from 表
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb
create proc p_calc
as
declare @s varchar(8000)
declare tb cursor for select s='update 表 set mon=('+bb+') where id='+cast(id as varchar) from 表
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb
as
declare @s varchar(8000)
declare tb cursor for select s='update 表 set mon=('+bh+') where id='+cast(id as varchar) from 表
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb
------------------------------>>>>
如果你不使用“:”和"@"号等