Hi, I have the following query:
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
The query is executed without problems when running in SQL Server 2008 R2 Developer (no matter how), SQL Server 2005 Express and SQL Server 2008 R2 Express using the management studio (this work for the last two). But as soon as I try to execute this queries using ADODB from Delphi I get an error saying.
Incorrect syntax near the keyword WITH
Are these kind of queries disallowed in the express versions of SQL? what is the problem in the query? The client uses SQL express, so I need to find a solution with this problem which runs in the express version.