<root xmlns:t="urn:schemas-microsoft-com:xml-sql">
<t:header>
    <t:param name="state">WA</t:param>
</t:header>
<t:query>
    SELECT CompanyName,ContactName,Phone
    FROM Customers AS Customer
    WHERE Region LIKE @state
    FOR XML NESTED
</t:query>
<t:xpath-query mapping-schema="nwind.xsd">
    /Customers[@Region=$state]
</t:xpath-query>
</root>

Example 1: XML template.

Back to Article