# ODBC sth.fetch\_hash

**URL:** <https://www.ruby-forum.com/t/odbc-sth-fetch-hash/202956>\
**Category:** Ruby\
**Created:** [February 9, 2011, 5:18pm UTC](https://www.ruby-forum.com/t/odbc-sth-fetch-hash/202956 "2011-02-09T17:18:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 9, 2011, 5:18pm UTC](https://www.ruby-forum.com/t/odbc-sth-fetch-hash/202956/1 "2011-02-09T17:18:05Z")

</div>

Hello All.

I am experiencing an issue with the fetch\_hash method in the DBI module.  
I am executing a rather complex SQL query to a DB2 database on our  
as400. The column names, in the key index, are coming up as integer  
values if the column names appear to be too long.

e.g  
{“00001”=\>"User data ", “OTHER\_COL\_NAME”=\>“MA1”}

The 00001 is the problem. I need to see the real column name here,  
which in my case is a concat of a two columns.

In PERL you can simply pass the ‘NAME\_lc’ to solve this however I don’t  
find anything possible for fetch\_hash.

PERL e.g  
while (my $ref = $$sth-\>fetchrow\_hashref(‘NAME\_lc’))

What am I missing or is this a bug?

Respectfully,  
Daniel

---

<div class="post-metadata">

**Author:** ![danielr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f17d59/32.png) [@danielr](https://www.ruby-forum.com/u/danielr)\
**Post date:** [February 9, 2011, 9:23pm UTC](https://www.ruby-forum.com/t/odbc-sth-fetch-hash/202956/2 "2011-02-09T21:23:55Z")

</div>

I did a bit of further research and found that it appears that this is  
coming from ODBC. My question is how do you override this? I think it  
something to do with SQL\_MAX\_COLUMN\_NAME\_LEN…

Anyone have experience with this?

Thanks so much…
