table row(s) - copy as "table"

chivi's profile image chivi posted 2 years ago in Feature discussion Permalink

Folks, I see, this question was asked variously so many times in the past, but to be honest, I didn't find an answer:

  • do we have an option to copy sql query output in a table format - format not suitable for anything else but for human consumption?

I believe, it is default output format in mysql shell. Might be we can have the same in HeidiSQL "copy as" menu?

Thank you for answer.

ansgar's profile image ansgar posted 2 years ago Permalink

Did you try out the delimited text output? You can for example use a Tab as field separator, which makes the output quite readable.

chivi's profile image chivi posted 2 years ago Permalink

Thank you, @ansgar. Delimited text output is not a bad idea, however there is one problem - vertical strings' alignment. I will show example:

chivi@Lenovo-G50-30:~/Desktop$ cat text_delimited 
Column1;Column2;Column3;Column4
AString;AString;AString;AString
ALongString;ALongString;ALongString;ALongString
EvenLongerString;EvenLongerString;EvenLongerString;EvenLongerString

chivi@Lenovo-G50-30:~/Desktop$ cat text_delimited | tr ";" "\t"
Column1 Column2 Column3 Column4
AString AString AString AString
ALongString ALongString ALongString ALongString
EvenLongerString    EvenLongerString    EvenLongerString    EvenLongerString

chivi@Lenovo-G50-30:~/Desktop$ cat text_delimited | tr ";" "\t" | column -t
Column1           Column2           Column3           Column4
AString           AString           AString           AString
ALongString       ALongString       ALongString       ALongString
EvenLongerString  EvenLongerString  EvenLongerString  EvenLongerString

Ideally I would like to have the last (table) output data format. Provided example is aggravated, when your SELECT has output of 20+ columns.

ansgar's profile image ansgar posted 2 years ago Permalink

Yes, tab is just a tick better than any other single char, but of course broken with longer text.

I could probably create a new export format for that kind of "human readable text". Could you please create an issue in the tracker?

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