gpt4 book ai didi

sql-server - 查询(SQL Server 2008 Express)在 SQL Server Management Studio 中有效,但在使用 ADODB 的 Delphi 中无效

转载 作者:行者123 更新时间:2023-12-03 18:15:25 25 4
gpt4 key购买 nike

我有以下查询:

WITH cte AS (
SELECT
windowId, frameIndx, elemIndx, comment,
ROW_NUMBER() OVER (PARTITION BY frameIndx ORDER BY elemIndx DESC)
AS
rn
FROM
dbo.translations
WHERE
windowId = 1 AND frameIndx IN (
SELECT
indx
FROM
dbo.translations_window
WHERE program_id = 1 AND active = 1
)
)
SELECT
windowId, frameIndx, elemIndx, comment
FROM
cte
WHERE
rn = 1

在 SQL Server 2008 R2 Developer(无论如何)、SQL Server 2005 Express 和 SQL Server 2008 R2 Express 中使用管理工作室(这适用于最后两个)运行时,查询执行没有问题。但是,一旦我尝试使用 Delphi 中的 ADODB 执行此查询,我就会收到一条错误消息。

Incorrect syntax near the keyword WITH

在 SQL 的快速版本中是否不允许使用这些类型的查询?查询中的问题是什么?客户端使用 SQL express,所以我需要找到一个在 express 版本中运行的解决方案。

最佳答案

我不知道它是否有帮助,但你可以尝试 put a semicolon在您的查询之前:

; WITH cte AS (
...

关于sql-server - 查询(SQL Server 2008 Express)在 SQL Server Management Studio 中有效,但在使用 ADODB 的 Delphi 中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3855798/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com