I am having trouble storing the result of a "select for xml" into an xml variable. I am trying to do something like this:
declare @m xml
select @m=(select value from MyTable for xml auto)
select @m as m
If MyTable contains only few records then anything is fine but, when MyTable contains more records (Ex:4700) the result is empty. It's intresting that even for more than 10000 records the select the result is OK:
select value from MyTable for xml auto
works fine but:
select value from MyTable for xml auto, type
is empty.
I did something wrong or is it a bug? Is there any workaround for this? The xml variable is important for me because I want to make some operations later on the xml content using XML-DML. I'm using MSSQL2008 SP1
Please help me!