This project is read-only.

WITH clause causing tests to fail

Feb 16, 2012 at 9:32 PM
Edited Feb 16, 2012 at 9:33 PM


I haven't seen this anywhere, but creating BI.QUALITY test queries that include subqueries using the WITH clause fail, even though the same queries can be executed in MS SQL Management Studio without error. When I run these queries inside N-Unit I get:

BI.Quality.QueryTest.3-General\5-StaffDimension\DimStaffADPIDoverlappingDates:Exception ouccured while executing the query: Deferred prepare could not be completed.Statement(s) could not be prepared.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.


I cannot terminate the preceding statement with a semicolon because there is no preceding statement. the WITH clause is effectively the first statement in the query.


Any help would be appreciated.

Rodney Noland

QA Developer

Jan 7, 2013 at 11:54 AM

Yes, looks like only expressions starting with SELECT are allowed. Thomas, any update on this?