[CLOSED] Using common table expressions (CTEs) in DBMS SQL Flow
I am trying to create a DBMS SQL Flow where the SQL statement contains common table expressions. When I try to run the SQL, I get...
(FOC1400) SQLCODE IS -1 (HEX: FFFFFFFF) : Microsoft OLE DB Provider for SQL Server:  Multiple-step OLE DB operat : ion generated errors. Check each OLE DB status value, if available. No w : ork was done. (FOC1406) SQL OPEN CURSOR ERROR. : SQLOUT
I had this issue before with a DM procedure. I had an SQL statement that had a CTE in it. I was able to use it by using the following commands before the SQL statement and then ending it with END.
ENGINE SQLMSS SET CURSORS CLIENT
SQL SQLMSS PREPARE TEMP_HOLD FOR
If I try to use this inside the DBMS SQL Flow, I get...
(FOC1400) SQLCODE IS 195 (HEX: 000000C3) XOPEN: 42000 : Microsoft OLE DB Provider for SQL Server:  'CURSORS' is not a rec : ognized SET option.  Incorrect syntax near the keyword 'with'. If : this statement is a common table expression, an xmlnamespaces clause or : a change tracking context clause, the previous statement must be termin : ated with a semicolon.  Incorrect syntax near ','.  Incorr : ect syntax near ','. (FOC1414) EXECUTE IMMEDIATE ERROR.
Any ideas on how to get this working with changing the SQL around to remove the CTEs?This message has been edited. Last edited by: Tamra,
iDM 7.7.05 WebFOCUS 7.7.05 Windows, All Outputs
October 28, 2013, 11:08 AM
Because the MS SQL Server error message complains of a missing semicolon I have suspicion that the issue, and thus a possible workaround is the same as in this forum post: