SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
FR: Script grid results

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
FR: Script grid results
Author Message
Mindflux



Joined: 25 May 2013
Posts: 804
Country: United States

Post FR: Script grid results Reply with quote
Is there a way we can select rows or columns from the grid results and script those to an insert statement so that it'll wrap the data in quotes and commas for insert into scripting or other scripting needs ? There are tools that do this for SSMS (SSMS tools pack or RedGate sql prompt). Neither of which are free or I use.

Maybe there's already a way to do it and I don't know? SQL Assistant is so feature packed sometimes I miss things.

Examples:
http://www.ssmsboost.com/Features/ssms-add-in-results-grid-script-results
http://www.sqlservercentral.com/blogs/never_say_never/2011/02/13/ssms_2D00_tools_2D00_pack_2D00_script_2D00_grid_2D00_results/
https://www.cathrinewilhelmsen.net/2016/03/02/redgate-sql-prompt-results-grid-features/
Thu Nov 03, 2016 9:46 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
You cannot select a subset of cells and have only selected cell scripted. But you can certainly script the result set of simple queries. By simple I mean results of quick data preview and simple SELECT queries like
SELECT * FROM myTable WHERE colA < 100

Right-click the data-grid and choose Save as Script menu. Choose output options and it will save as script containing INSERT commands for the rows in the data-grid. The target database dialect depends on the selected Options. The script can be saved to a file or written to a new new code pane, from which with one-click you can copy it to the editor




Thu Nov 03, 2016 10:13 pm View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 804
Country: United States

Post Reply with quote
"Save as Script" is greyed out for me.

I did a simple select (no joins)...

the where was WHERE WSID='MyWSID'

if I take the where out, the save as script is usable.. but now I have far too many results to sift through?

*Edit: Doesn't matter what I'm selecting for the WHERE. It greys out the Save as.
Fri Nov 04, 2016 8:58 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
Are you running 9.0.176 or an older version?
Does the table have primary key?
Is that menu enabled when you right-click that table in database explorer and select "Quick Data Preview" command?
Fri Nov 04, 2016 9:53 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 804
Country: United States

Post Reply with quote
SysOp wrote:
Are you running 9.0.176 or an older version?
Does the table have primary key?
Is that menu enabled when you right-click that table in database explorer and select "Quick Data Preview" command?


Running 9.0.176
Yes PK
Yes

It's only when I add a where clause to my TSQL statement where the right click option goes out.
Fri Nov 04, 2016 9:55 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
Weird, I tested it with several tables and it doesn't seem to work consistently. For some tables it works with a WHERE clause, for some it doesn't. I also observed that whenever Save as Script is disabled, the Edit mode is disabled too. But when I use Quick Data Preview or drop the WHERE clause, then it works for all of my tables. I'm going to ask for more help on this one, and will get back to you early next week.
Fri Nov 04, 2016 11:18 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2100

Post Reply with quote
I tested this one and experienced rather erratic behavior. I was unable to find any tables that would leave Save As Script enabled when querying with WHERE but figured out that (not) having a statement terminator (;) affects the state of mentioned context menu item.
Fri Nov 04, 2016 5:50 pm View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 804
Country: United States

Post Reply with quote
gemisigo wrote:
I tested this one and experienced rather erratic behavior. I was unable to find any tables that would leave Save As Script enabled when querying with WHERE but figured out that (not) having a statement terminator (;) affects the state of mentioned context menu item.


That's odd (and I can comfirm) that leaving the (;) off on a generic select with no where works, add the semi colon and suddenly you can't script it at all.

On top of the other odd behavior.
Fri Nov 04, 2016 6:01 pm View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 804
Country: United States

Post Reply with quote
It appears this one is still open.
Wed Nov 23, 2016 9:43 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
Mindflux wrote:
It appears this one is still open.


You are correct. The fix for this issue is still developing.
Wed Nov 23, 2016 7:56 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7833

Post Reply with quote
SysOp wrote:
Mindflux wrote:
It appears this one is still open.


You are correct. The fix for this issue is still developing.


The fix for this issue is available in the latest released build 9.0.194
Fri Dec 02, 2016 2:09 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.