Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

SQL Server 2016 Management Studio Enhancements

$
0
0

By:Rajendra Gupta || Related Tips:More > SQL Server Management Studio

Problem

In this previous tip New Features in SQL Server Management Studio for SQL Server 2016 , we have seen some of the new SQL Server Management Studio features and improvements. However, the tool has improved a lot since that tip and in this tip we will look at exciting enhancements to SQL Server Management Studio.

Solution

We have seen in tip SQL Server 2016 RC0 Installation and Configuration Changes that SQL Server Management Studio is now not a part of the normal SQL Server installation, we have to download it separately and install.

In this tip I am working on the latest SQL Server Management Studio July release which can be download from this link .

While working with this latest version of Management Studio I came across some important and exciting features that I will outline below.

Highlight Current Line in SQL Server Management Studio

First thing you will notice when connected to Management Studio is a box appearing in the Query Window. Basically the box is pointing to the current line position of the cursor.


SQL Server 2016 Management Studio Enhancements

As we move to other lines it moves to that line and we can also see a blue vertical bar to highlight this as shown below:


SQL Server 2016 Management Studio Enhancements

This is pretty useful to point out the current line however if we don't want to use this functionality, we have the option to disable it via: Tools -> Options -> Text Editor -> General -> Highlight Current Line. By default this options is enabled, so to disable remove the check box from the Highlight Current Line as shown below.


SQL Server 2016 Management Studio Enhancements
Searching for Options in SQL Server Management Studio

While exploring the option to disable the highlight current line option, I noticed there is a search feature to find options in the Tools -> Options menu. For example, if we want to search for "highlight current", the search will show which tree items include the string. For this example it shows Test Editor -> General.

This is a good enhancement to search for a particular options instead of browsing each tab when we do not know exactly where the setting resides.


SQL Server 2016 Management Studio Enhancements
SQL Server Management Studio Quick Launch

Another search option provided in Management Studio is the Quick Launch, which we can see on top right of the interface:


SQL Server 2016 Management Studio Enhancements

This is a new search tool to launch menu items, options and files. It will not work for searching text inside a Query Window.

Suppose you want to use the Database Engine Tuning Advisor, if you type "database"in the Quick Launch it will show all the options matching the word "database" as a link:


SQL Server 2016 Management Studio Enhancements

Clicking on the option will open the item which in this case is the Database Engine Tuning Advisor:


SQL Server 2016 Management Studio Enhancements

Later when I search in the Quick Launch for "data", I can see the Database Engine Tuning Advisor listed in the Most Recently Used section. Quick Launch caches the last 5 opened items in the Most Recently Used section that match the criteria.

Basically it includes four sections as part of search:


SQL Server 2016 Management Studio Enhancements
Most Recently used: Matching results from most recently used search, maximum 5 Menus: Matching results available from menu section. Options: Matching results from Options section. Open documents: Matching results from open document section.

If we type @ in the quick launch, it gives you shortcuts by which you can limit the search.


SQL Server 2016 Management Studio Enhancements

The options are:

@mru: for searching only in Most Recently Used @menu: for searching in Menus section @opt : for searching in Options section @doc: for searching in Open Documents section

Suppose we want to search Live Query Statistics for Menus only, we type:


SQL Server 2016 Management Studio Enhancements

To see options for Quick launch, type quick launch in the search box and click on the Options item:


SQL Server 2016 Management Studio Enhancements

This shows the options for quick launch as:


SQL Server 2016 Management Studio Enhancements

We can see we have the option to:

Enable or disable the quick launch functionality Enable or disable the quick search area (i.e. if we don't want to search in Open Documents, remove the check box)
SQL Server 2016 Management Studio Enhancements

When disabling a Quick Launch option from search, SQL Server Management Studio needs to be restarted for the change to commit.

We can see matching results for Open Documents is not shown after a Management Studio restart:


SQL Server 2016 Management Studio Enhancements
SQL Server Management Studio Tabs Customization

When we open a New Query Window, by default its name contains the following information: FileName.Instance Name.Database Name along with the credential used to connect as shown below:


SQL Server 2016 Management Studio Enhancements

Sometimes we don't want that much information to be shown. To customize the display, go to Tools -> Options -> Editor Tab and Status Bar.

Here we can see the options for Tab Text:

Include Database Name - True Include File Name - True Include Login Name - True Include Server Name - True
SQL Server 2016 Management Studio Enhancements

Suppose we want to have only server name and database name for the tab text, so disable the other options by setting them to False as shown below:


SQL Server 2016 Management Studio Enhancements

If we open a new tab it will include only server name.database name:


SQL Server 2016 Management Studio Enhancements
Pin Tabs in SQL Server Management Studio

In a New Query Window tab there is a new toggle pin as highlighted below:


SQL Server 2016 Management Studio Enhancements

This feature enables us to pin query windows we like or use frequently as shown below (i.e. backup script and performance script).


SQL Server 2016 Management Studio Enhancements

I have two pinned tabs and after I open several new query windows I can still see my pinned tabs.

To better organize the pinned tabs, we can keep them on a separate row by navigating to Tools -> Options -> Tabs and Windows the

Viewing all articles
Browse latest Browse all 3160

Trending Articles