how do i tell how big my xml docs (or vars) are in sql?

datalength

from BOL - "Returns the number of bytes used to represent any expression."

the individual that asked me about this recently started using some much larger xml objects in their xml datatype column. it threw off sql because the stats weren't being updated and caused some performance issues which an update statistics and a clustered index rebuild corrected.

this also works with the xml datatype variables. so you can do a

declare @x xml
set @x = 'some xml here'
select datalength(@x)




 

posted @ Friday, June 15, 2007 5:52 PM

Print
Comments have been closed on this topic.