Toad World® Forums

Comma-delimited column list for a table


Using TOAD TDP 3.5.0 over an ODBC connection, is there any way to quickly grab a comma-delimited list of columns for a particular table? TOAD for Oracle has such a feature… using the “describe table” dialog, it’s possible to highlight all columns of the table and click a button to pop the list into clipboard. Basically, if my table has 100 columns C1 through C100, I’m looking for a quick & easy way to get string “C1, C2, C3, … C99, C100” to copy/paste into my SQL.


Did you want to do this from a result window? If so just right click in the result frame and pick Quick Export/File/CSV File. Otherwise click on Tools/Export/Export Wizzard then Next, Add, and click on Tables and follow the rest of the screens. If this is something you will be repeating often I recomend the Export Wizzard as you can save the export template and then just run the template each time or better yet schedule it with automation if you need it every Monday morning or something like that.


I forgot if you want to just copy an paste for SQL like an in statement. Highlight the cells in the result window that you want right click them, select copy, when the dialog box pops up click on the “No headers, insert statement or in clause formatted text” radio button. When you paste this into your sql you will get a nice (value, value, value, etc.). It will put single quotes around each value if it is a text field. Real handy.


Nice! With the single-quotes, it’s still a tad off off hitting the target, but that’s nothing a quick find/replace won’t fix… Amusingly, a fraction of a second after realizing that, I realized I’d been overlooking a workable solution all along. When I was using the default copy behavior, and retrieving the column names as 1-value-per-line, all I needed to do was paste, highlight, and use regexp find/replace:

Find: ([^\n])+\n

Replace: $1,

Since the find/replace of a single quote is less keystrokes though, I’ll definitely be using the approach you gave.