16 March 2017
16 March 2017

3 Results Grid features SQL Prompt brings to SSMS

Guest post

This is a guest post from Cathrine Wilhelmsen. A Friend of Redgate and experienced SQL Server data warehouse architect and business intelligence developer, Cathrine is a Community Evangelist for PASS and a Microsoft MVP.

She dedicates her time to growing the global community of Microsoft data platform professionals and is also a board member of the Microsoft Data Platform User Group Norway, and the main organizer of SQLSaturday Oslo.

She can be found on Twitter and she regularly blogs about technology issues.

You may not have heard about it yet, but three helpful features were recently added to SQL Prompt that are activated when you right-click on the Results Grid in SQL Server Management Studio (SSMS).

1. Copy as IN clause

This feature is available when you have values from a single column selected. You can select the entire column, parts of the column, or even single values in the column. Right-click and select Copy as IN clause.

The values you selected will be formatted as a list that you can paste into a query:

SSMS Results Grid 1

2. Script as INSERT

When you select the entire grid, adjacent rows, adjacent columns, a single cell, or a block of cells, this second feature is now available. Simply right-click and select Script as INSERT.

A new tab is automatically created with a script containing the values you selected. This script creates a temp table with the column names and data types from the original query. It inserts the selected values and drops the temp table. This is such a time-saver for me, even if I only need the INSERT part of the script.

SSMS Results Grid 2

3. Open in Excel

When you select the entire grid, adjacent rows, adjacent columns, a single cell, or a block of cells you can also right-click and select Open in Excel.

This opens a new Excel file with the selected values and column names in the first row. This is perfect for when I quickly need to send some data to our business users:

SSMS Results Grid 3

Now watch the video

If you’d like to see a demo of the new features in action, watch this short video:

Bonus tip

If you don’t like the way the auto-generated code looks, by the way, you can also use the new SQL Prompt formatting options to make it more attractive or better fit the style your team uses.

If you’re not a SQL Prompt user, download a free trial and see how much more productive you can be writing code every day.

Like this? Share it with other SQL professionals using the social sharing buttons below. Simply tweet: I’ve just read @cathrinew’s blog on 3 useful Results Grid features in #SQLPrompt – see the #SuperSQLTip at http://rd.gt/2mBQ1lr

Tools in this post

SQL Prompt

Write, format, and refactor SQL effortlessly in SQL Server Management Studio and Visual Studio.

Find out more

Guest post

This is a guest post from Cathrine Wilhelmsen. A Friend of Redgate and experienced SQL Server data warehouse architect and business intelligence developer, Cathrine is a Community Evangelist for PASS and a Microsoft MVP.

She dedicates her time to growing the global community of Microsoft data platform professionals and is also a board member of the Microsoft Data Platform User Group Norway, and the main organizer of SQLSaturday Oslo.

She can be found on Twitter and she regularly blogs about technology issues.

Share this post.

Share on FacebookShare on Google+Share on LinkedInTweet about this on Twitter

Related posts

Also in Hub

How to Test SQL Server Functions and Procedures using SQL Prompt

When writing functions or procedures, a common chore is to devise and implement the tests that ensure that the routine always works as expected. The best way to do this is to define the tests in a bat...

Also in Product learning

Baselining a ReadyRoll project from an existing database

Deploying schema changes to SQL Server databases can be tricky when you’d like to automate parts of your workflow. For instance, how do you go about version controlling your schema changes? In appli...

Also in SQL Prompt

How to use the SQL Prompt snippet placeholders for selecting and copying text

There are four SQL Prompt snippet placeholders that are all about selection and copying of text:

$PASTE$
Inserts the contents of the clipboard at that position.

$SELECTEDTEXT$
Inserts the select...

Also about SQL Prompt

How you can improve your SQL with code analysis in SQL Prompt

What is code analysis?

Code analysis is a formal automated process of scanning a piece of software code and deducing potential problems, issues and faults that may not be apparent to programmers at f...