DECLARE @stSqlString NVARCHAR(MAX) = ''
DECLARE @stStrXml XML
SET @stSqlString = 'set @stStrXml=(select * from TableName FOR XML AUTO, elements)'
EXEC sp_executesql @stSqlString, N'@stStrXml XML OUTPUT',@stStrXml OUTPUT
SELECT @stStrXml
DECLARE @stStrXml XML
SET @stSqlString = 'set @stStrXml=(select * from TableName FOR XML AUTO, elements)'
EXEC sp_executesql @stSqlString, N'@stStrXml XML OUTPUT',@stStrXml OUTPUT
SELECT @stStrXml
0 Comments