declare testcurs cursor for select 'dbo.' + name from sysobjects where xtype = 'u'open testcurs declare @tname nvarchar(517) fetch next from testcurs into @tname while @@fetch_status = 0 begin exec sp_changeobjectowner @tname, 'test' fetch next from testcurs into @tname end close testcurs deallocate testcurs反正是以上代码的意思,但以上代码出错了! 麻烦看看,谢谢!
'Corporate\GeorgeW' 是什么呀? 不明! 我的如何改呢?
EXEC sp_changeobjectowner 'A', 'dbo';
GO
dbo是使用者
你要做什麼,說詳細點
for
select 'dbo.' + name
from sysobjects
where xtype = 'u'open testcurs
declare @tname nvarchar(517)
fetch next from testcurs into @tname
while @@fetch_status = 0
begin
exec sp_changeobjectowner @tname, 'test'
fetch next from testcurs into @tname
end
close testcurs
deallocate testcurs反正是以上代码的意思,但以上代码出错了! 麻烦看看,谢谢!
exec sp_changeobjectowner @tname, 'test'
你这里是将表的使用者更改为test。