檢視、內嵌函數、衍生資料表及子查詢中若包含集合運算子,則 FOR XML 子句無效。若要解決此問題,請使用衍生資料表語法包裝內含集合運算子的 SELECT,並在其最上層套用 FOR XML。
Click to search this error in Google
English version
The FOR XML clause is invalid in views, inline functions, derived tables, and subqueries when they contain a set operator. To work around, wrap the SELECT containing a set operator using derived table syntax and apply FOR XML on top of it.