SELECT @Name = Name FROM Table FOR XML AUTO
Does not work, how do you get the XML result from using FOR XML into a variable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will work:
You can try it without the wrapping
CONVERT(XML, (...))statement but I’ve found that SQL Server doesn’t like assigning to XML variables without that explicit cast.