Introduction

xmltable() extracts a sequence of multi-valued elements from an XML document, and assembles a SQL table of those elements. A single call to xmltable() replaces a T-SQL loop performing multiple calls to xmlextract on each iteration. This function is invoked as a derived table (a parenthesized subquery specified in the from clause of another SQL query). Calling xmltable() is equivalent to executing a single xmlextract expression for each row of the table generated by xmltable().

xmltable() is a generalization of xmlextract. Both functions return data extracted from an XML document that is an argument in the function. The differences are: