Generate Scripts Based on the Result Grid
Just like in Toad and SSMSBoost, there's a facility to create a script such as INSERT based from the given result grid. This would be handy in generating test data or re-populating tables
![](https://secure.gravatar.com/avatar/fe0c3cbe1cc76ee03f19328f9c251f8d?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
This is included in SQL Prompt 7.1 which you can download from http://www.red-gate.com/products/sql-development/sql-prompt/
-
Lewis Valentine commented
I like the script as insert, but what i would like is the ability to generate and insert for the line. Not into a temp table, but into the original table. This would be useful for copying data between databases, or more commonly if i want a new row, but just a few columns different. I could generate the insert, then change the column data as needed.
-
Mickey Stuewe commented
Table variables are also written to the tempdb, but don't have indexes. Table variables assume there is only 1 row in the table prior to SQL Server 2014 and 100 rows with SQL Server 2014 and higher.
-
Joe Momberg commented
How about an option to generate this using a table variable rather than a temp table? Or have an if exists then drop so that it won't barf if run twice?
-
Mickey Stuewe commented
Create a shortcut that will run the hightlighted SELECT statement and create INSERT statements from the output in a popup window or in the Text Results pane.
-
Marvin commented
Thanks David for the suggestion but I just tried the plugin and it involves more steps unlike having it as an option in the result grid when you right click on it.
Additional, you need to have a separate window and execute the script again to have the desired output.
Lastly, if you could see the SSMSBoost functionality regading this feature, there's more option and flexibility available.
I think this would be a good feature within SQL Prompt.
-
There's a free SSMS add-in called TSQL Flex that might help here https://github.com/nycdotnet/TSqlFlex