Essayez ce qui suit : Declare @xmldata xml set @xmldata = (select ... From test for xml...) select @xmldata as returnXml