feature-request add tag
PeterVandivier
Consider the following...

<>https://dbfiddle.uk/NbgYdq52?hide=2

...currently rendering as...

![image.png](/image?hash=447fcf2d2368a5932d702ab9248d6af18e00ef54a66a33cb7ef754024d3fd3c8)

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

![image.png](/image?hash=082b46bc7ff7d1ee1e49e797351df8fae3be9055c55e33456e75fa0581df8641)

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.