feature-request add tag
Consider the following...


...currently rendering as...


I crafted this fiddle to support https://dba.stackexchange.com/a/329214/68127, which includes a screencap of an XML result in the post body. 

The fiddle results as-is would be more instructive to this use case if they were pretty-printed as in SSMS.
Top Answer
Jack Douglas
Thanks, this is a good suggestion and it's now implemented.

Your query result is of type `NVARCHAR(MAX)` so you need to [use the `TYPE` directive](https://learn.microsoft.com/en-us/sql/relational-databases/xml/type-directive-in-for-xml-queries?view=sql-server-ver16):

> SQL Server support for the xml (Transact-SQL) data type enables you to optionally request that the result of a FOR XML query be returned as xml by specifying the TYPE directive.

This makes the pretty-printing kick in: https://dbfiddle.uk/G4ZyrGCo?hide=2


Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.