duanjie5570 2012-10-19 00:25
浏览 46
已采纳

2个相同的apache / php安装从同一个SQL Server数据库返回不同的结果

I wrote the code on my development machine WinXPsp3, which has apache standalone 2.2.21. The query worked fine.

I then copied the php over my production machine WinXPsp3, which had apache 2.2 windows installation with php 5.3.5 windows installation, and is the SQL Server machine, but the query crashed.

I uninstalled apache and php on the production machine and copied my stand-alone version over from the development machine, but when I started apache, I got an error that MSCPV100.dll was missing. I installed MS C++ Redist, and that problem went away.

The query is as follows:

    SELECT TOP (50) 
    [ID], 
    (SELECT Case 
    WHEN [Location] is null then 'Unknown' 
    WHEN [Location]='' THEN 'Unknown' 
    ELSE UPPER([Location]) END
     + ', ' as [text()] FROM dbo.[OtherTable] 
    WHERE [OtherTable].[Key]=[Table].[ID] FOR XML path('')) AS Locations 
    FROM Table

(any mis-formatting here is not reflective of my actual query, as it works on other apache installations)

The query is choking on the lower-case "AS" before [text()] with "Incorrect Syntax near the Keyword 'as'".

The query was originally in uppercase, and had many more fields, so I used lower case until I found out which "AS" the failure description was talking about.

I tried replacing the "[]" around text() with "''", but that didn't help.

The facts I know to be true:

  • The apache installations are identical.

  • The php installations are identical.

  • The query works fine when hosted through the identical installation
    of apache on a different machine.

  • Other queries are working fine on the production machine after the
    apache/php upgrade.

This information leads me to believe that there's something awry with the production machine, and not apache, sql server, php, or the query. Any ideas as to what that might be?

A couple of things I didn't mention:

The PHP connection type is odbc.

The SQL Server ODBC drivers on both machines are 2000.85.1132.0, but the production machine also has SQL Server Native Client 10.0 version 2007.100.2531.00.

  • 写回答

1条回答 默认 最新

  • doupin8555 2012-10-19 17:27
    关注

    Ok, I pulled a snafu - I was "endode"ing the plus sign on one server, while I was "encodeURIComponent"ing on the other. So much for copy/paste - my bad. Thanks for looking anyway!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败