Skip to Content.
Sympa Menu

freetds - Re: [freetds] Column Aliasing with MS SQL Server

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Column Aliasing with MS SQL Server
  • Date: Tue, 21 Jul 2009 09:26:54 +0200

2009/7/21 James K. Lowden <jklowden AT freetds.org>:
> Derek Parnell wrote:
>>
>> Before we could use column aliases for singular column names, for
>> instance, a query might be:
>>
>> SELECT Descr AS Description FROM SomeTable;
>>
>> Before, when calling odbc_fetch_array, we would get associative arrays
>> with the key names being "Description".  However, now we get them called
>> "Descr".
>>
>> If I alter the query slightly to be
>> SELECT Descr + '' AS Description FROM SomeTable;
>>
>> then the key names are actually "Description", as we want.
>
> It really sounds like something local on your client, not in the FreeTDS
> or ODBC configuration, because isql works.
>
> I would use TDSDUMP to look at the data coming back from the server.  I'm
> sure you'll see the string "Description" as UCS-2 in the metadata packet.
> Make sure you're using TDS 7.0 or higher.
>
> The other thing to try is DBI_TRACE (Perl, right?).  If you set that to
> level 3 or 4, I think you'll see the individual ODBC function calls.  If
> you can discover the name of the function returning "Descr", that might
> lead to something to look at more closely.
>
> HTH.
>

Mmm... I think LAMP is Linux Apache MySQL PHP. IMO you can use ODBC
trace. Probably PHP use wrong column information.
ODBC support a lot of informations about results. To support cursors
we added support for many of these informations.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page