update sysobjects set uid=b.uid from sysobjects a,sysusers b where a.uid=b.uid and and a.name="要改的表名" and b.name="要改的用户名'此法行!但出错!(服务器: 消息 259,级别 16,状态 2,行 1 未启用对系统目录的特殊更新。系统管理员必须重新配置 SQL Server 以允许这种操作。)请问如何配置,才能启用对系统目录的特殊更新?
--假如你的用户帐号是“user1”USE 你的数据库名 GO set nocount on declare @objectname sysname,@username varchar(50),@str varchar(1000) declare #cursor cursor for select o.name,u.name from sysobjects o join sysusers u on u.uid=o.uid where u.name='user1' open #cursor fetch next from #cursor into @objectname,@username while @@fetch_status=0 begin set @str=''''+@username+'.'+@objectname+'''' exec sp_changeobjectowner @str, 'dbo' fetch next from #cursor into @objectname,@username end close #cursor deallocate #cursor set nocount off
set uid=b.uid
from sysobjects a,sysusers b
where a.uid=b.uid and and a.name="要改的表名" and b.name="要改的用户名'
由普通用户的所有者,改为DBO所有者,不行:sp_changeobjectowner 'tb1','dbo'(服务器: 消息 15001,级别 16,状态 1,过程 sp_changeobjectowner,行 38
对象 'tb1' 不存在或不是对此操作有效的对象。)
set uid=b.uid
from sysobjects a,sysusers b
where a.uid=b.uid and and a.name="要改的表名" and b.name="要改的用户名'此法行!但出错!(服务器: 消息 259,级别 16,状态 2,行 1
未启用对系统目录的特殊更新。系统管理员必须重新配置 SQL Server 以允许这种操作。)请问如何配置,才能启用对系统目录的特殊更新?
GO
set nocount on
declare @objectname sysname,@username varchar(50),@str varchar(1000)
declare #cursor cursor for select o.name,u.name from sysobjects o join sysusers u on u.uid=o.uid where u.name='user1'
open #cursor
fetch next from #cursor into @objectname,@username
while @@fetch_status=0
begin
set @str=''''+@username+'.'+@objectname+''''
exec sp_changeobjectowner @str, 'dbo'
fetch next from #cursor into @objectname,@username
end
close #cursor
deallocate #cursor
set nocount off