[英]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 警告:odbc_exec()[function.odbc-exec]:SQL错误:[unixODBC] [FreeTDS] [SQL Server]无效的列名“ Host”。SQLExecDirect中的SQL状态S0022
Query in PHP 用PHP查询
$query ="SELECT General/Host Title FROM TempReservations";
SQL Server Statement SQL Server语句
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. 如@Andrew的注释所示,您可以使用方括号来分隔列名。 The links provide more information about identifiers and delimited identifiers .
链接提供了有关标识符和定界标识符的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.