批量修改数据库构架SQL

不多说直接上码

declare @name sysname 
declare csr1 cursor 
for 
select TABLE_NAME from INFORMATION_SCHEMA.TABLES 
open csr1 FETCH NEXT FROM csr1 INTO @name 
while (@@FETCH_STATUS=0) 
BEGIN 
SET @name='nw22104.' + @name 
print 'ALTER SCHEMA dbo ' +' TRANSFER ' + @name 
fetch next from csr1 into @name 
END CLOSE csr1
posted @ 2012-11-06 17:04  诸葛风流  阅读(365)  评论(0编辑  收藏  举报