开发者

Query SQL Server DB with PHP & ODBC from Linux box

开发者 https://www.devze.com 2023-01-30 22:51 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消