SQLSERVR 重建索引
Sql2000语法:
select 'DBCC DBREINDEX(' + object_name(id) + ','''')'
from sysindexes
where id in (select id from sysobjects where xtype='U') and indid in (0,1)
sql2005及以上版本语法:
select 'DBCC DBREINDEX(' + name + ','''')' from sys.tables where type_desc='USER_TABLE' order by name