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 对于这个问题的代码运行
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败