Incorrect syntax near ';' - Works in SQL Server, not from Servicestack.ORMLite -



Incorrect syntax near ';' - Works in SQL Server, not from Servicestack.ORMLite -

i executing sql statement through servicestack.ormlite. statement of next format:

with rowdata ( select t1.v1, t1.v2 datakey, t2.v1 datavalue t1 left bring together t2 on t2.rowid = t1.rowid ) select * rowdata pivot ( sum(datavalue) datakey in ([1],[2],[3],[4],[5]) )as pivttable

this executes correctly in sql server, , in oracle (with few little changes). however, when executing through servicestack.ormlite using 'db.select (sql)' command, next error:

incorrect syntax near keyword 'with'. if statement mutual table expression, xmlnamespaces clause or alter tracking context clause, previous statement must terminated semicolon.

terminating semicolon returns next error:

incorrect syntax near ';'

executing every other 'select' statement works fine, not if begins 'with' or else seems. not appear servicestack.ormlite error - both system.data.sqlclient.sqlexceptions. if re-create generated code generated in debug sql server management studio, works fine, execute same code though ormlite , fails.

any ideas?

servicestack.ormlite not ctes. should @ using custom sql apis, see here

something this:

var sql = @"with rowdata ( select t1.v1, t1.v2 datakey, t2.v1 datavalue t1 left bring together t2 on t2.rowid = t1.rowid ) select * rowdata pivot ( sum(datavalue) datakey in ([1],[2],[3],[4],[5]) )as pivttable" list<mytype> results = db.sqllist<mytype>(sql);

sql sql-server ormlite-servicestack

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -