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'
查出不是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'