Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to use recursive sql syntax against DB2 version 8.01

When I try to use this recursive sql syntax in a

derived table

-


;WITH myCTE (CustID, Co) AS

(

SELECT CustomerID, CompanyName FROM Customers

)

SELECT CustID, Co FROM myCTE

-


I get an error :

Exception: DBD,[IBM][Cli Driver][db2] SQL0199N The use of the reserved word "AS" following "" is not valid Expected Tokens may include: "FULL LEFT INNER RIGHT". SQLSTATE =42601

If I use the same syntax in Toad against the same

DB2 no errors at all.

All the help is highly repreciated

thanks

Finn

replied

Finn,

is it possible that you have some non-printable characters like a certain type of carriage return or tab embedded in the SQL code that makes the error appear?

Thanks,

John

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question