Copy/Paste select results

[expired user #10476]'s profile image [expired user #10476] posted 8 years ago in General Permalink

I tried searching for the answer, but only things popping up are answers from 6 years ago when things were different.

I can normally select multiple rows/columns in a select result, but Ctrl+C copies only the highlighted cell. Is there an option to make it copy multiple cells (in any format)? I know there is an "export grid cells" feature, but it isn't handy to go through multiple menus/forms/windows for such a simple task.

Thank you.

kalvaro's profile image kalvaro posted 8 years ago Permalink

I think it's a good idea, esp. considering that you can already select rows and having Ctrl+C copy only one item is not particularly intuitive.

I've just checked SQL Server Management Studio and Oracle SQL Developer and both copy selected rows as tab-separated values.

ansgar's profile image ansgar posted 8 years ago Permalink

Yes, definitely a good idea. I guess it would be good to use some normal CSV format when just copying without the grid export dialog.

[expired user #10485]'s profile image [expired user #10485] posted 8 years ago Permalink

Commenting here to show interest in that functionality. Going through multiple menus to export a small number of rows is way to tedious.

[expired user #10476]'s profile image [expired user #10476] posted 8 years ago Permalink

It might as well work as a shortcut for export grid rows, actually, just preset. For example, you can set up a parameter combination (Excel CSV/Delimited Text/XML ...; delimiter, line terminator...) you like somewhere in options, and then Ctrl+C "exports" in that same format to clipboard. That would make it simpler to implement, too, I assume.

Thanks for considering this! :)

head's profile image head posted 8 years ago Permalink

Seems this thread not same old like rest of similar ones.

Is primary key won't export?! See screens.

2 attachment(s):
  • b
  • e
ansgar's profile image ansgar posted 8 years ago Permalink

You probably need to check the option "Include auto increment column" to get the primary key column.

1 attachment(s):
  • grid-export-primarykey
ansgar's profile image ansgar posted 8 years ago Permalink

To come back to the initial feature request here:

What about adding a new checkbox to the grid-export dialog, labelled "Set default copy mode", which - when the user checks it - sets all options for upcoming copy-to-clipboard clicks on a grid.

head's profile image head posted 8 years ago Permalink

to check the option "Include auto increment column" That's it! And about checkbox - good idea, but it will appear somewhere in global settings, otherwise it may be difficult to remember "where heck it was"?

head's profile image head posted 8 years ago Permalink

Sorry, i'm not familiar with markup here :)

ansgar's profile image ansgar posted 8 years ago Permalink

I meant the checkbox to live on the export dialog, in the free space at the bottom.

1 attachment(s):
  • export-grid-copy-settings
head's profile image head posted 8 years ago Permalink

I got idea. I'm about "Set default copy mode" - if it makes GLOBAL settings change - it will be in preferences - someone may set it and forgot where to uncheck. Optionally (and ideally) - in both places.

[expired user #10476]'s profile image [expired user #10476] posted 8 years ago Permalink

ansgar: could you post here when you add this feature, so I know when to update :). Thank you! :D

Code modification/commit ba30091 from ansgarbecker, 8 years ago, revision 9.4.0.5160
Use the grid export dialog for setting values for copy-to-clipboard clicks on grids. Adds a new button in the lower left on that dialog. See https://www.heidisql.com/forum.php?t=23190
ansgar's profile image ansgar posted 8 years ago Permalink

See my additions in r5160.

Not sure if that was a good idea though, as I personally and probably others too, would expect HeidiSQL to copy the single focused cell to clipboard. But we will see what you say.

If you find bugs please report them here.

ansgar's profile image ansgar posted 8 years ago Permalink

See the attached screenshot for the new button/feature.

Also notice that only the yellow settings are used as copy-to-clipboard settings. I think the others make not much sense here.

1 attachment(s):
  • grid-export-clipboard-settings
[expired user #8023]'s profile image [expired user #8023] posted 8 years ago Permalink

I'm not sure, if this is a good idea.

With older versions "copy" only copied the selected cell. Now the complete row is copied every time. To copy one cell, you have to go to "edit-mode" to copy the cell. That's possible but inconvenient.

But if you have a query with a join you can't go to edit-mode of a cell. So it's not possible to copy one cell of a select result with a join. That's not good.

Maybe there should be two functions: copy cell to clipboard. Copy selected rows to clipboard.

For me, the best solutions looks different: First, it should be possible to select only some columns and not only complete rows.

If one cell is selected. Only this cell should be copied. If multiple columns and/or rows are selected, only the selected columns/rows should be copied (with the preferences from export dialog).

head's profile image head posted 8 years ago Permalink

Alternate idea - make additional shortcut for "Copy all selected". I suggest Ctrl+Shift+C. And use dialog settings for.

head's profile image head posted 8 years ago Permalink

And button in dialog can be used to set default "Copy all" settings.

ansgar's profile image ansgar posted 8 years ago Permalink

Yes, I guess that's a good idea. So, the "Copy" and "Cut" menu items work again as in previous builds, and we have a new menu item for the more complex copy thing.

head's profile image head posted 8 years ago Permalink

Yes!!! :)

[expired user #10589]'s profile image [expired user #10589] posted 8 years ago Permalink

Hi. I did not like the idea. I really miss to copy a field Ideal: Ctrl + c : Copy current field Ctrl + Shift + c : Copy rows.

Thank's Ansgar.

[expired user #10590]'s profile image [expired user #10590] posted 8 years ago Permalink

Hi if i pressed Ctrl + c not copy the sigle field but start export procedure the copy-function work well with Ctrl+shit+c. This is a problem because the combination key don't work

leeoniya's profile image leeoniya posted 8 years ago Permalink

I frequently use Ctrl+C to copy cell contents from both query results and the data view, this no longer works. To echo what other have stated, I think the original behavior should be kept and an additional Ctrl+Shift+C can be used for the new copy-rows behavior.

head's profile image head posted 8 years ago Permalink

ubelni wait. What's wrong? My idea (accepted by Ansgar) was EXACTLY same. Ctrl+C usual copy field. Ctrl+Shift+C - copy selected rows.

leeoniya - same. Are you guys reading somewhere else instead of this forum?

head's profile image head posted 8 years ago Permalink

Ansgar, please roll build with default Ctrl+C behavior asap to avoid further screams :)

Code modification/commit 654dace from ansgarbecker, 8 years ago, revision 9.4.0.5163
Create a new menu item for copying rows to clipboard, and assign Ctr+Shift+C to it. See https://www.heidisql.com/forum.php?t=23190#p23490
ansgar's profile image ansgar posted 8 years ago Permalink

Please update to r5163 - under the "Copy" menu item you will now find a "Copy selected rows" item, which does the above discussed stuff. The "Copy" menu item again only copies the single cell contents.

[expired user #9126]'s profile image [expired user #9126] posted 8 years ago Permalink

Ansgar, current solution is OK (and much more convenient than always going to Export), but it would be much more practical if you would actually use "context" - if there is no selection (active is only one cell), copy this value... if there is something selected (more than one row), Ctrl+C would be expected to copy all selected rows and never single value. Only single-row "selection" (which doesn't seem to exist) would need extra clicking in menu (copy selected rows).

head's profile image head posted 8 years ago Permalink

bzoks, simple copy picks one cell anyway, and "there is no selection" not about Heidi, it's more about Excel - in Heidi you always have active cell and selected row. Thus Ctrl+C to pick cell value and Ctrl+Shift+C to pick entire row. I think it's absolutely acceptable. If you need less data in row - make SELECT required fields. If you need more rows- just shift-click them.

head's profile image head posted 8 years ago Permalink

Bad answers can't be edited. bzoks, for example - imagine you have manually selected 72 of 100 displayed rows and then need to copy one single value without deselect.

[expired user #9126]'s profile image [expired user #9126] posted 8 years ago Permalink

I believe it is much more common scenario that I want to select and copy all results... and heidi could know that more rows are selected and would copy them with ordinary Ctrl+C... "picking" few rows is very rare, but also other tools always copy selection, never current value. So your need to copy single value regardless selection is quite unique :) If needed, I would put such unique scenario to menu, not most common ones. So - I'm still suggesting to detect multiple-rows selection and copy them with regular Ctrl+C. Single row "selection" would always copy single value (not row), except with other shortcut/menu.

head's profile image head posted 8 years ago Permalink

That case may require selection appearance review - for now there's no visual difference in selecting single value or row, and it doesn't allow to select few cells instead of entire row. If Ansgar ready to implement Excel-like selection, it can be easily combined with your idea. For now it's not trivial to determine Visually what you have selected - cell or row.

[expired user #9126]'s profile image [expired user #9126] posted 8 years ago Permalink

That's why I'm saying that single-row can't be automatically determined, but for multiple rows it shouldn't be a problem. I'm not talking about column selection, only row selection.

head's profile image head posted 8 years ago Permalink

I got your idea, more than one row = Ctrl+C to copy.

But then you'll read here new screams "I can't select only ONE row and copy with Ctrl+C, WHY?". So it's mainly about Excel-like selection, and it's up to Ansgar.

ansgar's profile image ansgar posted 8 years ago Permalink

I think it's more clear to have two explicit menu items with their own shortcut, regardless of the current row/cell selection. That's also what I learned in the above discussion with the other users here.

head's profile image head posted 8 years ago Permalink

johnworne sorry, what's your problem?

Please login to leave a reply, or register at first.