SQL Server 2005: Error with CTE (Common Table Expressions)
Posted: Mon 27 Mar 2006 22:50
Hello,
I've started an app that will be a client to SQL Server 2005. I'm using a couple of their new SQL commands, to avoid using cursors in a query where I need to get the nth row.
I'm not sure whether this is an issue the CoreLab stuff or Microsoft. In any case when I run the query in Query analyzer, it runs okay. When trying to run it in Delphi I get this error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'WITH'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
Msg 102, Level 15, State 1, Line 16
Incorrect syntax near ')'.
This also happens when I surround the query with parenthesis in Query Analyzer.
All help appreciated,
Thanks!
I've started an app that will be a client to SQL Server 2005. I'm using a couple of their new SQL commands, to avoid using cursors in a query where I need to get the nth row.
I'm not sure whether this is an issue the CoreLab stuff or Microsoft. In any case when I run the query in Query analyzer, it runs okay. When trying to run it in Delphi I get this error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'WITH'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
Msg 102, Level 15, State 1, Line 16
Incorrect syntax near ')'.
This also happens when I surround the query with parenthesis in Query Analyzer.
All help appreciated,
Thanks!