oracle想批量修改某一列的值,修改成成bh0001,bh0002以次往下,怎么实现,感谢!
1个回答
2018-04-24 · 知道合伙人互联网行家
关注
展开全部
可以用游标解决:
declare @dbname nvarchar(20)
declare curdb cursor for
select name from master..sysdatabases where name like 'depart%' --找出所有要更新的数据库
open curdb
fetch next from curdb into @dbname
while @@fetch_status=0
begin
exec ('update '+ @dbname +'..SPML SET PM=''相应名称'' WHERE BH=''相应名称'' ' )
fetch next from curdb into @dbname
end
close curdb
deallocate curdb
declare @dbname nvarchar(20)
declare curdb cursor for
select name from master..sysdatabases where name like 'depart%' --找出所有要更新的数据库
open curdb
fetch next from curdb into @dbname
while @@fetch_status=0
begin
exec ('update '+ @dbname +'..SPML SET PM=''相应名称'' WHERE BH=''相应名称'' ' )
fetch next from curdb into @dbname
end
close curdb
deallocate curdb
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询