ASE does not currently support Common Table Expression (CTE) syntax
CTE would provide a WITH clause to define what is essentially a temporary view that can be referenced like a permanent table or view in a subsequent SELECT.
This is similar in concept to derived tables, but allows the same definition to be used multiple times without repeating the definition for each derived table.
Example ('range' is defined once but used with 5 different aliases in the FROM clause):
WITH range AS ( SELECT NM1 AS c FROM #TEST1 UNION SELECT NM2 FROM #TEST1 UNION SELECT NM3 FROM #TEST1 UNION SELECT NM4 FROM #TEST1 UNION SELECT NM5 FROM #TEST1)
SELECT r1.c, r2.c, r3.c, r4.c, r5.c
FROM range r1, range r2, range r3, range r4, range r5
WHERE r1.c<r2.c AND r2.c<r3.c AND r3.c<r4.c AND r4.c<r5.c
- SAP Adaptive Server Enterprise (ASE) all versions
- SAP Adaptive Server Enterprise Cluster Edition (ASE CE) all versions
sybase, common table expression, cte, derived table, feature request , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , BC-SYB-ASE-CE , ASE Cluster Edition (Standalone) , Product Enhancement
About this pageThis is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP ONE Support launchpad (Login required).
Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.