Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有谁知道如何将查询提示与“FOR XML”语句一起使用?我的(子)查询如下所示:
SELECT ','+RTRIM(username) FROM @TmpDistinctUsers WHERE vergabe_nr = b1.vergabe_nr ORDER BY rn DESC FOR XML path(''),elements
当我添加
OPTION (RECOMPILE)
我收到语法错误...
谢谢
您不能将其添加为子查询的一部分。
查看SELECT的文档
[ OPTION ( <query_hint> [ ,...n ] ) ]
OPTION 转到主查询的末尾。