在数据库中改变对象的所有者

查出不是dbo的所有对象
select sysobjects.name,sysusers.name from sysobjects ,sysusers
where sysusers.uid=sysobjects.uid and sysusers.name<>'dbo'
产生SQL 语句
select 'EXEC sp_changeobjectowner '''+ sysusers.name+'.'+sysobjects.name +''',''dbo'''
from sysobjects ,sysusers
where sysusers.uid=sysobjects.uid and sysusers.name<>'dbo'
然后全选复制,粘贴运行.

你可能感兴趣的:(数据库)