写个存储过程吧,我也遇到过这个问题。不过我写的是对一条记录复制,如果是多条,
可以多执行几遍。可能有更好的办法。
CREATE procedure CopyR
@TableName sysname,
@FieldName sysname,
@Value sysname,
@NewValue sysname
As
declare @Str sysname
select @str='Select * into temp1 from '+@TableName+' where '+@FieldName+'='+''''+@Value+''''
exec (@str)
select @Value=@Value+'a'
select @str='update temp1 set '+@FieldName+'='+''''+@NewValue+''''
exec (@str)
Select @str='insert into '+@TableName+' select * from temp1'
exec (@str)
Select @str='drop table temp1'
exec (@str)