How is an XML column stored in SQL Server 2008?

I am trying to understand how SQL Server 2008 stores xml columns in order to estimate the size of the table in our product.

I use DATALENGTH(xml_column) to run some test, and the results violate:

 Xml document length | Datalength | Bytes per character 175 | 366 | 2.09 15 | 38 | 2.53 314 | 414 | 1.31 

Obviously, the xml column type is not hidden nvarchar(max) , as I read somewhere.

It is probably compressed and stored as a binary, but cannot find it anywhere.

Can someone explain to me how the xml column is stored in SQL Server 2008?

+8
xml sql-server sql-server-2008
source share
2 answers

As rene pointed out , SQL Server 2008 uses MS-BINXML , a compact binary format, to hold the contents of xml columns.

+5
source share

The XML column is stored in a "compact binary format."

I doubt that Microsoft will provide you more detailed information.

+7
source share

All Articles