반응형
SET NOCOUNT ON
DECLARE TableList CURSOR FOR
SELECT name
FROM sysobjects
WHERE type = 'U'
ORDER BY name
DECLARE @table sysname
, @ExecStr varchar(500)
OPEN TableList
FETCH NEXT FROM TableList INTO @table
WHILE @@FETCH_STATUS <> -1
BEGIN
PRINT @table
EXEC ('dbcc dbreindex(''' + @table + ''')')
FETCH NEXT FROM TableList INTO @table
END
DEALLOCATE TableList
[출처] 시스템상의 모든 인덱스를 재구성하는 프로시저 |작성자 진카자마
반응형