Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Choose which column names are returned via ODBC when working with DB2 files

When working with DB2 files with columns that have both short and long names, there is no option choose which column names are returned via ODBC because SQL-based interfaces use the long column name by default.

My application has DB2 files with columns that have both a short and long name (alias). Both are visible via DSPFFD and selection over SYSCOLUMNS. Using STRSQL or QM, I can toggle between views. I can also do this in Client Access download.

Using ODBC, I only seem to be able to get the long name returned. Is there any way to change or affect which column names are returned via ODBC?

Versions of my database has been deployed on Oracle (which does not support the column alias feature) and iSeries, and the tool I am using to copy data between them is hitting problems with column-matching. Ideally I would not have to recode the application, or amend the DB2 database to get around this.
There is no option for changing the column names returned by the IBM System i Access ODBC driver since SQL -based interfaces use the long column name by default. The long name is the "real" column name from an SQL perspective - that's why the long name is stored in the column name field in the SYSCOLUMNS catalog view.

Unfortunately it sounds like you're having to deal with the complexities that arise when you move a copy of your DB2 data to another database.
This was last published in June 2009

Dig Deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.