title: SQL database re-Indexing script
body: <p>What is happening when running below script against SQL Server databases.  </p>
  
  <p>My script:</p>
  
  <pre><code>set arithabort on
  set quoted_identifier on    
  
  use TestDB
  
  declare objcur cursor for
      select name
      from sysobjects
      where type = 'u'
      order by name    
  
  declare @obj sysname    
  
  open objcur   
  fetch next from objcur into @obj    
  
  while (@@fetch_status = 0)
  begin
      dbcc dbreindex( @obj ) WITH NO_INFOMSGS   
  
      fetch next from objcur into @obj
  end   
  
  deallocate objcur
  </code></pre>