文件名称:重建索引-不动产登记数据整合技术方案
文件大小:236KB
文件格式:PDF
更新时间:2024-07-09 17:02:11
金碟数据
二、重建索引 上面的 SQL执行完成后,继续输入以下 SQL语句执行: DECLARE @DBCCString NVARCHAR(1000) DECLARE @TableName VARCHAR(100) DECLARE Cur_Index CURSOR FOR SELECT Name AS TblName FROM sysobjects WHERE xType='U' ORDER BY TblName FOR READ ONLY OPEN Cur_Index FETCH NEXT FROM Cur_Index INTO @TableName WHILE @@FETCH_STATUS=0 BEGIN PRINT '重建表' + @TableName +'的索引Start!' SET @DBCCString = 'DBCC DBREINDEX(@TblName,'''')WITH NO_INFOMSGS' EXEC SP_EXECUTESQL @DBCCString, N'@TblName VARCHAR(100)', @TableName PRINT '重建表' + @TableName +'的索引END!' FETCH NEXT FROM Cur_Index INTO @TableName END CLOSE Cur_Index DEALLOCATE Cur_Index PRINT '操作完成!'