1
votes

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)
1
Use brackets for the fields - just like in the table definition snippet you posted. So you could use SELECT [General\Host Title] FROM #TempReservations - Andrew

1 Answers

0
votes

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.