Toad World® Forums

Copy Column Headers to Clipboard

Hi,

Please let me know if this is the right place to ask for new stuff! One feature I would LOVE to have when I right-click on a result set is to be able to “Copy Column Headers” (in addition to the existing “Copy Rows” and “Copy Cells”). My own use cases are comma+space-delimited (“horizontal”), or comma+newline delimited (“vertical”). Then I can paste directly into an INSERT or SELECT statement and be on my merry way. This is particularly useful when writing ROW_NUMBER-type queries.

Currently I use a Notepad++ macro to do the same thing. MySQL Query Browser used to have this functionality and I find I still use it constantly in T-SQL land. It is a big time saver!

Best,

KJ

Hi,

there is an option list available during Copy Rows operation. I suppose ‘Include headers, insert statement formatted text’ is what you are looking for.

Hi,

Thanks for the tip. Yes that does kinda work, but the downsides are:

  1. Depending on how many rows are selected we will have to clean it up the pasted text for just the field names

  2. We can no longer specify a default copy mode, since now we have to rely on the confirmation window every time we want to copy. This means one more mouse click or a few extra keystrokes, e.g. we can no longer hit Ctrl-C and expect it to send to Clipboard. We’re going for speed!

I know this is totally discretionary, but we used to use “Copy Column Headers” as a right-click option in the old MySQL browser and it was hugely time-saving when building out a new set of sprocs with lots of INSERT statements.

Much obliged,

KJ

I’m using Toad 11.6.

type “desc table_name”

In the resulting window, you will see a clipboard button. You can grab the headers or even assign an alias to the column names. I think this is what you are looking for.

Tom

Hi Tom,

Thanks for the suggestion. Sorry to be a numbnut, but is that a query to run? Typing “DESC Tablename” and hitting F5, for example, doesn’t do anything.

In any event, if we’re creating a complicated SELECT statement with multiple JOINs, we still would like a quick way to pull out the resulting column headers. Imagine, for example, if we’re only updating a subset of the columns.

We just discovered SSMS Boost puts this at our fingertips in, well, Management Studio. Still would love to stick with Toad, but momentum is tough to fight …

  • KJ