Hi Charlie,

Don’t know if this will help, but I frequently see CTEs written with a leading 
semicolon before the WITH keyword – e.g. ;WITH cte AS…

IIRC this is required by the SQL engine -- maybe give that a shot?
--Phil

From: ARSList <[email protected]> On Behalf Of Charlie Lotridge
Sent: Tuesday, February 19, 2019 1:37 PM
To: ARSList <[email protected]>
Subject: Common Table Expression SQL for menus

Hi all,

I'm trying to use a SQL query containing a Common Table Expression for a 
drop-down menu. I can see that the query is submitted to the server and is 
appropriately generating results. But the menu comes back as empty.

For anyone not familiar, a Common Table Expression (CTE) is a construct 
supported by (at least) SQL Server that allows for some extreme flexibility in 
the generation of result sets, in some cases things that you just can't do 
without it. In SQL Server queries containing CTEs begin with a "WITH" keyword 
instead of "SELECT". I don't know if other database systems support this 
construct.

One workaround is to embed the query into a SQL view, then query the view. I've 
used this workaround in the past but it is not entirely convenient or elegant.

Has anyone else had this problem and maybe have some insight as to why it's 
failing or perhaps developed a better workaround?

Incidentally, this is on an ARS system running v8.1.

Thanks,
Charlie
-- 
ARSList mailing list
[email protected]
https://mailman.rrr.se/cgi/listinfo/arslist

Reply via email to