Redgate SQL Prompt 7.1 Results Grid Features

Redgate SQL PromptRedgate recently released SQL Prompt 7.1. I try to be an efficient developer (read: I’m a lazy and often impatient developer), so I’m a huge fan of any feature that can save me some clicks here and some time there. In this version, SQL Prompt comes with new Results Grid Features. And let me tell you… I rarely hear so many business users and business analysts ask me: How did you do that!?

Well, let me show you :)

(Like this video? Check out the other 14 Super SQL Tips!)

Redgate SQL Prompt 7.1 Results Grid Features

If you have SQL Server Management Studio 2012 (or Visual Studio 2012) and higher, you will see three new features when you right-click on the Results Grid: Copy as IN clause, Script as INSERT and Open in Excel:
Redgate SQL Prompt 7.1 - Results Grid Features

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:
Redgate SQL Prompt 7.1 - Results Grid Features: Copy As In Clause

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

Script as INSERT

This feature is available when you select the entire grid, adjacent rows, adjacent columns, a single cell, or a block of cells. Right-click and select Script as INSERT:
Redgate SQL Prompt 7.1 - Results Grid Features: Script As Insert

A new tab is automatically created with a script containing the values you selected. The script creates a temp table with the column names and data types from the original query, 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 :)

Open in Excel

This feature is available when you select the entire grid, adjacent rows, adjacent columns, a single cell, or a block of cells. Right-click and select Open in Excel:
Redgate SQL Prompt 7.1 - Results Grid Features: 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:

P.S. Redgate has already made improvements to the Open in Excel feature in the SQL Prompt 7.2 Beta!

Bonus Tip

If you you don’t like the way the auto-generated code looks, just use SQL PromptFormat SQL (CTRL+K, CTRL+Y) to make it pretty :)

Who is Cathrine Wilhelmsen?

Cathrine is a Microsoft Data Platform MVP, BimlHero, author, speaker, blogger and chronic volunteer who loves teaching and sharing knowledge. She works as a consultant, technical architect and developer, focusing on Data Warehouse and Business Intelligence projects. She loves sci-fi, chocolate, craft beers, ciders, cat gifs and smilies :)

4 thoughts on “Redgate SQL Prompt 7.1 Results Grid Features”

Really cool. I like the “Open in Excel” feature a lot!
Does the “IN ” clause also works with varchar fields? Does it look something like IN (‘Value1’, ‘Value 2’ ) ?

Hi Kraaitje, the copy as IN clause also works with VARCHAR fields. You will get a list that looks like this:

IN
(
N'The Shawshank Redemption',
N'The Godfather',
N'The Godfather: Part II',
N'The Dark Knight',
N'12 Angry Men',
N'Schindler''s List',
N'Pulp Fiction',
N'Il buono, il brutto, il cattivo',
N'The Lord of the Rings: The Return of the King',
N'Fight Club'
)

Thanks Catherine. I never new this existed.

Great feature! I used all 3 options within the first day.

Share Your Thoughts?