简体   繁体   中英

Using Query Hint on FOR XML

does anyone know how about using Query Hints with the "FOR XML" statement? My (Sub-)Query looks like this:

SELECT ','+RTRIM(username) FROM @TmpDistinctUsers 
WHERE vergabe_nr = b1.vergabe_nr            
ORDER BY  rn DESC
FOR XML path(''),elements

When I add

OPTION (RECOMPILE)

I get Syntax errors...

thx

You can not add that as a part of the subquery.

Have a look at the documentation for SELECT

[ OPTION ( <query_hint> [ ,...n ] ) ]

OPTION goes to the end of the main query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM