declare @tablename varchar(50)
declare cur cursor for
select tablename from table1
open cur
fetch next from cur into @tablename
while @@FETCH_STATUS=0
begin
declare @sql varchar(max)
set @sql='
update '+@tablename+' set code=left(code,1)+''1''+right(LEN(code)-1)'
--加上括号
exec(@sql)
fetch next from cur into @tablename
end
close cur
deallocate cur