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

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rogermontague

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

Post by rogermontague » 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!

:?

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 28 Mar 2006 08:38

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

Post Reply