for xml 子句生成的结果如果保存至变量?
zejyu 2007-03-10 03:23:53 1、执行以下语句:
select top 1 * from Northwind..customers for xml auto,elements
得到XML结果:
<Northwind..customers><CustomerID>ALFKI</CustomerID><CompanyName>Alfreds Futterkiste</CompanyName><ContactName>Maria Anders</ContactName><ContactTitle>Sales Representative</ContactTitle><Address>Obere Str. 57</Address><City>Berlin</City><PostalCode>12209</PostalCode><Country>Germany</Country><Phone>030-0074321</Phone><Fax>030-0076545</Fax></Northwind..customers>
2、请问如何把这个结果保存到变量(Declare @S varchar(4000))