문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top