ALTER SCHEMA [dbo] TRANSFER [sq_szswdjd].COM_Category DECLARE @name VARCHAR(30);
declare csr1 cursor
for
select 'Name' = name
from sysobjects
where USER_NAME(uid)='sq_szswdjd'
order by name; open csr1 --循环读取游标记录,执行系统存储过程SP_ChangeObjectOwner修改对象所有者
FETCH NEXT FROM csr1 INTO @name
while (@@FETCH_STATUS=0)
BEGIN
SET @name='sq_szswdjd.'+@name
PRINT 'ALTER SCHEMA [dbo] TRANSFER '+@name+';';
fetch next from csr1 into @name
END
CLOSE csr1;