Hi Denis,

Interesting, I just had to look this up in the SQL Server manuals:
https://msdn.microsoft.com/en-us/library/ms177400.aspx

It appears that SQL Server has reused the common table expression syntax
(WITH) for an entirely different use-case. This means, you cannot use
jOOQ's with clause in this case, as jOOQ's with expects a Select as
argument.

The only options that I can see right now are:

- Use an ExecuteListener to inject the additional SQL string in
ExecuteListener.renderEnd()
- Prepend the additional SQL manually and execute the whole thing as "plain
SQL"

For example:

DSL.using(configuration).fetch("with xmlnamespaces (...) {0}", select);

Does that help?
Best Regards,
Lukas

2016-06-02 14:41 GMT+02:00 Denis Miorandi <[email protected]>:

> consider this query.
>
> --WARNING! ERRORS ENCOUNTERED DURING SQL PARSING!
> WITH XMLNAMESPACES (DEFAULT 'http://www.xxxx.com/api/yyyy')
>
> SELECT  a
>       ,b
>       ,SOME XML 's fields from RR.TT
>
> from TABLE
>   cross apply xml.nodes(' / MYROOT ') [RR]([TT])'
>
>
> I need just to add this literal string before select, but I don't know how to 
> achieve this.
>
>
> WITH XMLNAMESPACES (DEFAULT 'http://www.xxxx.com/api/yyyy')
>
>
> I know just how to add literal with DSL.VAL('') but how about before query?
>
>
>
> Tks
>
>
> Denis
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to