I'm using the The SQL Server Wire Protocol Driver and if I run the following query:
WITH
test
AS
(
SELECT * FROM HumanResources.Department
)
SELECT * FROM test;
I get:
HY000[319][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]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 terminated with a semicolon.
if I run the same in SQL Server management studio, it works fine; but if I use the SQL Server Wire Protocol Driver, I get that error.
That looks like a defect to me - the only non-default option I've selected is 'enable quoted identifiers'.
It should work as the driver does not do anything about the sql. Could you please provide us with more info, odbctrace, snoop, driver/server versions, and platform...? A repro will help here.
Thanks - I'll check internally and get back to you if I have relevant information. It's good to know the driver doesn't do anything about the SQL.