--云星空重建索引SQLDECLARE@sqlNVARCHAR(1000)=DBCCDBREINDEX(@TABLE_NAME)WITHNO_INFOMSGS;DECLARE@tblNVARCHAR(1000)=DECLAREtblcurCURSORFORSELECT[NAME]FROMsys.tablesWHERE[NAME]NOTLIKETMP%AND[NAME]NOTLIKEZ[_]%ORDERBY1FORREADONLYOPENtblcurFETCHNEXTFROMtblcurINTO@tblWHILE@@FETCH_STATUS=0BEGINEXECSP_EXECUTESQL@sql,N@table_nameNVARCHAR(1000),@tblPRINT表重建索引成功:+@tblFETCHNEXTFROMtblcurINTO@tblENDCLOSEtblcurDEALLOCATEtblcurPRINT全部执行完成!