SQL Server Management Studio (SSMS) is a wonderful tool but there are so many ways built-in shortcuts that many users don’t seem to be aware of.
A simple example, is if I want to script all the indexes on a table (or all the tables, all the stored procedures, etc, etc.). Yes you can do that the long way by using the Generate Scripts option 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:
But this is tedious when you want to script a whole set of them. Instead, start by clicking on the Indexes node itself:
When it’s selected, click F7 to open the Object Explorer Details pane:
Then click the top item, shift-click the bottom item (to select them all), and finally right-click to see that you can script all of them at once:
I hope that helps someone out there who wasn’t aware of this.