Re: MSSQL Server 2005 - select [field] AS [name] does not work?
Neil Whitaker <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
> -----Original Message----- > From: [email protected] [mailto:freetds- > [email protected]] On Behalf Of James K. Lowden > Sent: 15 May 2012 15:27 > To: [email protected] > Subject: Re: [freetds] MSSQL Server 2005 - select [field] AS [name] does not > work? > > On Tue, 15 May 2012 10:56:42 +0000 > Neil Whitaker <[email protected]> wrote: > > > You can see it should be [The_Key] => 1 > > > > It's reproducible - and I have access to two servers (one with FreeTDS > > 0.82, the other with 0.91) - both exhibit this behaviour. > > If you get the correct answer to the same query with isql or bsqlodbc, you > might want to report the problem to the PHP project. IIRC this has been > reported before and owes to PHP using the wrong property for the column > name. > > --jkl > > _______________________________________________ > FreeTDS mailing list > [email protected] > http://lists.ibiblio.org/mailman/listinfo/freetds Hi, It's a bit of a strange one as you can't very easily search for it ('AS' isn't the best keyword to try and find!), I tried it using isql, and it does work: SQL> select TOP 10 [EnquiryID] AS [Pri_Key] FROM [db].[dbo].[table]; +------------+ | Pri_Key | +------------+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | | 10 | +------------+ SQLRowCount returns 10 10 rows fetched So does this support your suggestion? It's worked with FreeTDS which shows it's getting the right data, but when used with PHP it's munging the wrong field names? Cheers Neil If you are not the intended recipient, please notify the sender immediately by replying to the e-mail, and then delete it without making copies or using it in any way. Although any attachments to the message will have been checked for viruses before transmission, you are urged to carry out your own virus check before opening attachments, since Acorn Stairlifts accepts no responsibility for loss or damage caused by software viruses.