SSMS Tips and Tricks 1-3: Script multiple objects at once
If you want to script all the indexes on a table (or all the tables, all the stored procedures, etc, etc.), you can do that the long way by using the Generate Scripts right-click option for a database, but there’s a better way.
Let’s use the Purchasing.PurchaseOrderLines table from WideWorldImporters as an example. Here are the indexes on it:
The scripting options are well-known. You right-click the object, and can navigate to the scripting option:
2025-05-11