USE  BookFactory
DECLARE @TableName varchar(255) 
DECLARE TableCursor CURSOR FOR 
SELECT TABLE_NAME FROM information_schema.tables 
WHERE table_type = 'base table'  and [TABLE_NAME] <> 'sysdiagrams'
OPEN TableCursor 
FETCH NEXT FROM TableCursor INTO @TableName 
WHILE @@FETCH_STATUS = 0 
BEGIN 
DBCC DBREINDEX(@TableName,' ',90) 
print @TableName
FETCH NEXT FROM TableCursor INTO @TableName 
END 
CLOSE TableCursor 
DEALLOCATE TableCursor
posted on 2010-12-09 12:17  Staid  阅读(265)  评论(0编辑  收藏  举报