4

Is there a way to predermine the length of returned XML Data from SQL Server.

Ex:

SELECT *
FROM Products
FOR XML RAW, ROOT('products')

I am using SQL Server 2005.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
RPS
  • 1,401
  • 8
  • 19
  • 32
  • See this post once http://stackoverflow.com/questions/6108272/how-to-find-the-size-of-data-returned-from-a-table – Rahul Jul 20 '11 at 22:03

1 Answers1

5
SELECT DATALENGTH (
                    (SELECT *
                    FROM products
                    FOR XML RAW, ROOT('products')
                    ) 
                )

It will give to you size in bytes. for details, see here: http://msdn.microsoft.com/en-us/library/ms173486(v=SQL.90).aspx

Dalex
  • 3,585
  • 19
  • 25