[freetds] Column Aliasing with MS SQL Server

Derek Parnell ParnellD at scc-fl.edu
Mon Jul 20 15:47:33 EDT 2009


Hello all,

I have configured a new server running SLES 10 and installed LAMP, along with FreeTDS and unixODBC to connect to our MS SQL Server.  I've copied the odbc.ini, odbcinst.ini and freetds.conf from our old server to this new one.  Things are "almost" the same as before.

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.

Also, when using isql to connect and run the first query above, everything comes out as I expect, with the column names being Description.

Any and all help is appreciated.




Derek Parnell
Seminole Community College
Department of Computing and Telecommunication Services
100 Weldon Boulevard
Sanford, Florida 32773-6199
407.708.2355


Please Note:
Due to Florida's very broad public records law, most written communications to or from College employees regarding College business are public records, available to the public and media upon request. Therefore, this e-mail communication may be subject to public disclosure.



More information about the FreeTDS mailing list