반응형
DECLARE @i int, @sql varchar(1000)
DECLARE @tablename varchar(1000),@ownerName varchar(1000)
SET @i = 1
DECLARE DB_Cursor CURSOR FOR
SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_SCHEMA, TABLE_NAME
OPEN DB_Cursor
FETCH NEXT FROM DB_Cursor
INTO @ownerName, @tablename
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sql = 'ALTER INDEX ALL ON ' + @ownerName + '.' + @tablename + ' REBUILD WITH (PAD_INDEX = ON, FILLFACTOR = 90) '
EXEC (@sql)
PRINT CONVERT(VARCHAR, @i) + '__' + @ownerName + '.' + @tablename + '............ OK'
SET @i = @i + 1
FETCH NEXT FROM DB_Cursor
INTO @ownerName, @tablename
END
CLOSE DB_Cursor
DEALLOCATE DB_Cursor
반응형
'모바일 & 앱' 카테고리의 다른 글
MSSQL CONVERT YYYY.MM.DD (0) | 2022.03.17 |
---|---|
같은 문자열 합치기 rowspan colspan (0) | 2022.03.15 |
MFC Default browser 무시하고 익스플로러 띄우기 (0) | 2021.11.12 |
MSSQL datetime 필드 사용시 1900-01-01이 곤란하다면 ISNULL 대신 COALESCE 함수 (0) | 2021.08.13 |
MSSQL OUTER APPLY (0) | 2021.07.23 |