Author |
Message |
THenrich
Joined: 17 Dec 2014 Posts: 20 Country: United States |
|
How to 'copy as sql insert' a selection from the grid? |
|
How to 'copy as sql insert' a selection from the result grid? It's creating all the rows and columns which I don't want. I also don't see an option to copy the results to the clipboard?
|
|
Fri Aug 20, 2021 1:37 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Hello. Are you using SQL Assistant SQL Editor IDE or something else?
Example below. This will only include columns that are show in the grid. If your query returns a subset of columns only those columns will be scripted.

|
|
Thu Sep 09, 2021 1:01 am |
|
 |
THenrich
Joined: 17 Dec 2014 Posts: 20 Country: United States |
|
|
|
I am using the SSMS add-on.
|
|
Wed Sep 15, 2021 2:45 pm |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
|
|
Can confirm OP's issue. If I select 3 columns out of a grid and do the "COPY AS SQL INSERT", it takes all the table columns with it.
Edit:
So you're saying it'll take all the columns in the result grid, so you need to pare it down first before using "COPY AS SQL INSERT"? You cannot highlight the columns you want copied (like your example seems to show is possible)?
|
|
Thu Sep 16, 2021 9:27 am |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
|
|
In learning about this, I am wondering why the insert into statement is repeated multiple times, rather than:
 |
 |
insert into table (foo, bar) VALUES ('foo','bar'),('fooo,'baz'),(etc...)?
|
|
|
Thu Sep 16, 2021 9:39 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
 |
 |
So you're saying it'll take all the columns in the result grid, so you need to pare it down first before using "COPY AS SQL INSERT"? You cannot highlight the columns you want copied (like your example seems to show is possible)? |
Correct, it saves the grid data to the script, not selected columns or selected values. In your query you can choose what exactly need to be scripted. This enables you to choose which columns or subset of rows to include, as well as enables to to add computed expressions whose values you want to be scripted too. It's very flexible in that sense.
|
|
Thu Sep 16, 2021 12:24 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
 |
 |
In learning about this, I am wondering why the insert into statement is repeated multiple times, rather than:
 |
 |
insert into table (foo, bar) VALUES ('foo','bar'),('fooo,'baz'),(etc...)?
|
|
Please wait for a little while. It's coming very soon :-)

|
|
Thu Sep 16, 2021 12:31 pm |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
|
|
huzzah!
|
|
Thu Sep 16, 2021 12:32 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
The beta version is out. An announcement with download link is in top message in this board.
|
|
Wed Sep 29, 2021 3:27 pm |
|
 |
|