Shortcut: Using bookmarks in SQL Server Management Studio

Shortcut: Using bookmarks in SQL Server Management Studio

In a previous post, I was discussing how outlining can be helpful with navigating around within a large T-SQL script file.

If you were trying to do that within a Microsoft Word document, the most common thing to use is bookmarks, and SQL Server Management Studio (SSMS) has them as well.

Bookmarks are simply placeholders within a script. (They can also apply to other types of document within SSMS). Where I find them very useful is when I’m working in two or three places within a long script at the same time. Perhaps I’m working on a function, and also on the code that calls the function. By using bookmarks, I’m not flipping endlessly around the script file, and can jump directly from placeholder to placeholder.

A quick check of the Bookmarks submenu (under the Edit menu), shows what’s available:

You toggle (enable or disable) a bookmark at a particular point, by using Ctrl-K and Ctrl-K. You can then navigate forwards or backwards using Ctrl-K and Ctrl-N (next), or Ctrl-K and Ctrl-P (previous).

Note that there are options available for both the document and the folder. The folder option can be particularly powerful.

Bookmarks are an often-ignored but highly useful part of using SSMS. If you don’t currently use them, you might want to consider them.

2018-07-26