Redgate 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:
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 in a query:
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 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!
If you you don’t like the way the auto-generated code looks, just use SQL Prompt → Format SQL (CTRL+K, CTRL+Y) to make it pretty :)