Query SQL Server DB with PHP & ODBC from Linux box
This is not a connection issue. I was given a query statement (See Below) so I have an idea of the DB structure. But when I do a simple Query: I am getting an error. There are "/" in the Field names. Do I need to escape those?
Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid column name 'Host'., SQL state S0022 in SQLExecDirect in
Query in PHP
$query ="SELECT General/Host Title FROM TempReservations";
SQL Server Statement
CREATE TABLE #TempReservations (
[Reservation_ID] [int] Null,
[General/Meeting Title] nVarchar(4000)开发者_开发知识库 NULL ,
[General/Host] nVarchar(200) NULL ,
[Room_ID] [int] NULL)
As indicated in @Andrew's comment, you can use brackets to delimit your column name. The links provide more information about identifiers and delimited identifiers.
精彩评论