How to create the INDEX REBUILD statement on some specific tables in a DB.
SELECT ‘ALTER INDEX ‘+name+ ‘ ON ‘+DB_NAME()+’.dbo.’+OBJECT_NAME(id)
+’ REBUILD WITH (ONLINE=ON, MAXDOP=1, SORT_IN_TEMPDB=ON) ‘,
OBJECT_NAME(id) Tablename,name FROM sys.sysindexes
WHERE OBJECT_NAME(id) IN( ‘table1’,
AND name not like ‘_WA%’ /* Removing _WA_Sys_ like things. What is _WA_Sys_?? Please go through the info in this blog as follows*/
order by OBJECT_NAME(id), indid
_WA_Sys_ is nothing but automatically created statistics. Can we avoid _WA_Sys_. Yes _WA_Sys_ can be avoided by turning the auto stats off. Run following code to turn auto stats off.
ALTER DATABASE Tuitionaffordable SET AUTO_CREATE_STATISTICS OFF
INTERVIEW PREPARATION IN 30 MINs – Read Following wires for a quick interview preparation.
- SQL Server DBA “Interview Questions And Answers”
- SQL Azure Interview Questions and Answers Part – 1
- SQL Azure Interview Questions and Answers Part – 2
- Powershell Interview Questions and Answers
Online MS SQL Classes @ http://tuitionaffordable.webstarts.com