XML element names in SQL Server come from your query, and FOR XML PATH lets you choose them. This post sets the row and root names, turns a column into an attribute, writes text inside an element and shows the error you get when an attribute column comes too late. Every result comes from SQL Server 2025.
FOR XML AUTO in SQL Server: Nest Joined Rows and Name the Root
FOR XML AUTO turns a join into nested XML, with one element per table. This post shows where the element names come from, why row order decides the grouping, how ROOT adds a single root, and how the order of your columns flips the nesting. Every result comes from SQL Server 2025.
FOR XML RAW in SQL Server: Row Names, ROOT, ELEMENTS and NULLs
FOR XML RAW turns each row of a query into an XML element. This post names the row element, adds a ROOT, switches to ELEMENTS and shows how a NULL value drops out of the output until XSINIL puts it back. Every result comes from SQL Server 2025.
EXECUTE AS OWNER in Stored Procedures: Power and Pitfalls
A procedure with owner rights can write to tables its caller cannot touch. Watch the identity change, and see how one careless parameter hands out too much.
What Is XML in SQL Server: Tags, Attributes and Well-Formed Rules
What is XML in SQL Server? It’s plain text where every value carries its own label. This post turns four plant rows into XML with FOR XML RAW, names the parts of a document, and shows the errors SQL Server returns when a rule is broken.







