Querying to construct XML in TSQL without a source table, only variables?

Posted by Darth Continent on Stack Overflow See other posts from Stack Overflow or by Darth Continent
Published on 2010-03-16T21:09:30Z Indexed on 2010/03/16 21:11 UTC
Read the original article Hit count: 466

Filed under:
|

Using a SELECT statement in MS SQL 2005 TSQL, and no source table, just variables as listed below...

@FirstName varchar(20)
@LastName varchar(20)
@ZipCode varchar(5)

...what syntax will build XML resembling the following?

<XMLDATA><REC FirstName="JOHN" LastName="SMITH" ZipCode="98052" /></XMLDATA>

© Stack Overflow or respective owner

Related posts about Xml

Related posts about tsql