日期:2014-05-16 浏览次数:20499 次
declare tb cursor local for select 'sp_changeobjectowner ''['+replace(user_name(uid),']',']]')+'].['+replace(name,']',']]')+']'',''dbo''' from sysobjects where xtype = 'U' and status>=0 and user_name(uid) <> 'dbo' open tb declare @s nvarchar(4000) fetch tb into @s while @@fetch_status=0 begin exec(@s) fetch tb into @s end close tb deallocate tb go