Just imagine all the right stuff is in between - the question is about the setting the xml @response = to the varchar @xml_output.
CREATE PROCEDURE [dbo].[sp_test]
@response XML OUTPUT )
SET @response = @xml_output --<<<<here
Just didnt realise you were asking about converting varchar data to xml, explicit conversion works there too
declare @varchar varchar(max) declare @xml xml set @varchar=stuff((select name from sys.tables for xml path('')),1,0,'') set @xml=@varchar ---- implicit conversion is allowed select @xml
- Edited by Satheesh Variath Friday, February 07, 2014 9:47 AM
Shouldnt be a problem!! As long as the @xml_output varchar variable has a valid xml format, no explicit casting is needed. Automatically the conversion is done.
declare @xml_output varchar(max)='<root><data>abc</data></root>' declare @response xml set @response=@xml_output select @response
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>