Column name list

Andy's profile image Andy posted 12 months ago in Feature discussion Permalink

Hi,

Is there a way to simply copy a list (say comma seperated) of all the fields that are present in a query or table?. Sometimes I need to get a list of all the fields used from a result set and this can be large - it would be really handy if there was a way to just "export" to copy to the clipboard with a button the names of all the fields returned by a query?

Or does Heidi already do this?

Thanks!

ansgar's profile image ansgar posted 12 months ago Permalink

For the currently focused table, you have some options in the query editor helpers on the very right, under "Columns":

grafik.png

Andy's profile image Andy posted 12 months ago Permalink

Ahh!!

Nice - thanks - love this app!

Andy's profile image Andy posted 12 months ago Permalink

Oh hang on - thats for the actual table - which is really usefull anyway, but what about a query I've run that produces say 20-30 fields in it's output. There doesn't seem to be a way to get a list of the field names?

So if I "SELECT *, Field1, field2, field3 FROM tableA LEFT JOIN fieldB" this might produce a large number of fields - granted I could piece together using a combo of what you suggest above and adding on the extra's, but would it not be easier to just have a simple static list of all the field names returned?

Andy

ansgar's profile image ansgar posted 12 months ago Permalink

Related to issue #2055 - but I read you want to use the column names in a query, right? A new "*" item in the completion proposal would be helpful.

Andy's profile image Andy posted 12 months ago Permalink

I use a lot of prepared statements with multi join tables so if I use an * I'll get every column returned which means I have to then specify each column in the statement which is clearly impractical. 5 tables with 10 fields in each all left joined is 50 field names so id clearly only specify the ones I'd need - but that could be 20 odd.

So what I'd like is to be able to run my queries and then have the ability to get a list of the fields names that the query returns.

ansgar's profile image ansgar posted 12 months ago Permalink

Well what I meant was a "*" item which expands to all column names, separated by comma when pressing Enter.

I can probably add an item in the header context menu:

grafik.png

In the end you should create a ticket for that. Probably you have a better specific idea?

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