How To Script All Indexes Of A Table Using SQL Server


Have you ever wanted to script all indexes for a particular table in SQL Server?



The solution is simple and requires no code.

  1. Open SQL Server Management Studio
  2. Click "Tools"
  3. Click "Options"
  4. Expand "SQL Server Object Explorer"
  5. Click "Scripting"
  6. Scroll to "Table And View Options"
  7. Click "Script Indexes" and set it to "True"
  8. Now right click on your Table in Object  Explorer
  9. Now Click "Script Table As" -> "CREATE TO" => "New Query Editor Window"
  10. All indexes for the table will be in the script generated.



There are no notes on this topic.

Add comment

  Country flag

  • Comment
  • Preview