From fury123 at gmail.com Sun Feb 1 19:37:04 2009 From: fury123 at gmail.com (rob) Date: Mon, 2 Feb 2009 01:37:04 +0100 Subject: [ruby-dbi-users] wrong results data from queries Message-ID: <8b6f4e0d0902011637i25ec3f0n400015dd6eb60008@mail.gmail.com> Hi, using dbi i am getting wrong data when i try to query a database, i try to explain with an example: In a table of the database i have a column with data type nvarchar(10), let's say that in a field i have a string like 0000000070, when i query the database for the data in that column, dbi returns me 000000007\000\000 (this is the result from row.inspect) If i strip the string in the row['data'] i get a string length 9 (but the data in the database is 10 length!) It is just an example, this problem happen to a lot of query that i execute on this database, it always replaces the last character of the data retrieved from the database with these \000\000, the real retrieved data is always missing the last character. The database that i use is MS SQL 2000 and to connect to it i use an ODBC driver. I was thinking that there was some problems in the odbc at first, but i tested same query, same database, same odbc driver using perl and dbi for perl and i get corrects results. So i suppose is a dbi problem, but i don't know where to look for to resolve it. Someone else has seen a similar problem ? Bye thanks for the help.