sql2000 孤立用户 因为选定的用户拥有对象,所以无法除去该用户的解决办法
作者:fengyn 日期:2009-10-08
--将下面的代码在查询分析器中执行,修改修改库名
use 你的库名
go
declare tb cursor local
for
select 'sp_changeobjectowner '
+quotename(
+quotename(user_name(uid))
+'.'+quotename(name),'''')
+',''dbo'''
from sysobjects
where objectproperty(id,N'isusertable')=1
and uid<>user_id('dbo')
declare @s nvarchar(4000)
open tb
fetch tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch tb into @s
end
close tb
deallocate tb
执行完毕就可以删除改用户了
另外参考 http://www.fengyn.cn/article.asp?id=152
use 你的库名
go
declare tb cursor local
for
select 'sp_changeobjectowner '
+quotename(
+quotename(user_name(uid))
+'.'+quotename(name),'''')
+',''dbo'''
from sysobjects
where objectproperty(id,N'isusertable')=1
and uid<>user_id('dbo')
declare @s nvarchar(4000)
open tb
fetch tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch tb into @s
end
close tb
deallocate tb
执行完毕就可以删除改用户了
另外参考 http://www.fengyn.cn/article.asp?id=152
评论: 0 | 引用: 0 | 查看次数: -
发表评论

上一篇
下一篇

文章来自:
Tags:
相关日志:
