Comma-delimited copy & paste from the same column
Closed this issue · 2 comments
Is your feature request related to a problem? Please describe.
SQL Pro studio has the ability to 'Copy selected as > Comma separated' but this only works if we select multiple columns in the same row. What would be fantastic is if we could select multiple results in the same column and comma-delimit those as well. Currently that doesn't work, it just pastes them on a new line.
Describe the solution you'd like
Would love the ability to copy multiple results in the same column of a query and be able to paste them as a comma-delimited string. What would be even better is if it respects the data type in the column and knows to either single-quote delimit as well for varchar/nvarchar else just comma delimit it.
e.g.
Column_1
A
B
C
D
when copied comma-delimited and pasted should be
'A','B','C','D'
Column_2
25.10238
23.28472
12.84193
2.51293
when copied comma-delimited and pasted should be
25.10238,23.28472,12.84193,2.51293
Describe alternatives you've considered
The only alternative is to copy the results in the column into an external text editor or tool that will then change the newline to a comma-delimited string or to manually comma & quote delimit the results.
Additional context
The additional benefit here is we can quickly copy values from the results of a query and build another query from it i.e. SELECT * FROM TABLE WHERE Column_1 IN ('A','B','C','D')
Environment (please complete the following information):
Device: Macbook Pro M1 Pro
OS: Sonoma 14.5
SQLPro app Version: SQLPro Studio Version 2024.38 (Build 111106.6)
Installation source: App Store
Target database server: Microsoft SQL Server, SQLite, MySQL
Hi,
Currently I have no plan for this unless it was requested by quite a few users as I think that behaviour would not be what most expect. My suggestion would be to use a pivot query (or compatible with your sql brand) to convert your columns into rows and do the copying based on that.
I didn't mean this would have to be the default copy from the same column behaviour, but an option for this would be nice.
If you explicitly highlight results from the same column then 'Copy selected as > Comma separated', you would expect the pasted result as comma-separated, right? Currently it just newlines the results, so in theory that logic isn't working as stated. I don't disagree with copy-paste by default via cmd+c newlining the results, just having another shortcut would be nice. I mean we're not all copying results out of the editor, sometimes we just want a quick way to build comma-delimited WHERE clauses for another query based on the results of a large dataset.