Page 1 of 1

SQL Server 2005: Error with CTE (Common Table Expressions)

Posted: Mon 27 Mar 2006 22:50
by rogermontague
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!

:?

Posted: Tue 28 Mar 2006 08:38
by Jackson
Please specify your query.
Also supply us following information:
- Exact version of Delphi or C++ Builder
- Exact version of SDAC. You can see it in About sheet of TMSConnection Editor
- Exact version of Microsoft SQL Server and OLE DB provider that you use.
You can see it in Info sheet of TMSConnection Editor