Getting SQL Query column names as variable

If you have a new question you’d like our support staff to post a response to, please visit our customer community, Data Security Insiders, to pose the question in our Discussion Boards. We have a thread “Ask Our Tech Experts” that our support team monitors on a regular basis, or you can start a new discussion where other GoAnywhere users and support staff can weigh in. Log in or create your new account at

If you need an immediate response, please create a support ticket or contact our support team by email at [email protected].
2 posts Page 1 of 1


Posts: 9
Joined: Tue Nov 03, 2015 5:35 pm

Post by john_a » Mon Nov 09, 2015 8:51 pm
Hi all, I am dealing with a DB2 table that has a large number of columns what would be nice to do is get a dump of the data from a table into either a CSV or an XML file with the column names included. Is there an easy way to do this.

If I cannot do that can I get the column names as collection of data so that the index of the collection matches its prospective value.

So,for instance --

${colName[3]} = 'Addr1'
${data[3]} = '90210 Mulholland Dr.'

So that if I do a SELECT * on the table and I can get a count of the fields it is a simple matter to do a data dump of the table.


Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Nov 10, 2015 9:51 am

You can do an SQL Select of your data from the DB2 Table, creating a rowset variable. Use that rowset variable to create (writeCSV) a CSV file. After defining the input from the Select Statement and giving it a file name to create, go to the Advanced Tab and change the "Include Column Headings" to true.

This will give you a CSV file with the 1st row being the Column Headings for each row.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1