日期:2014-05-17 浏览次数:20387 次
DECLARE @X XML
SET @X=(SELECT [姓名] FROM [奇葩人员信息表] FOR XML AUTO )
PRINT CONVERT(VARCHAR(MAX),@X)
if object_id('Userinfo', 'u') is not null
drop table Userinfo
Create table Userinfo
(
ID Varchar(12) primary key,
Name varchar(64) not null,
Age Int not null
)
Insert into Userinfo
Select '001' , '李大傻', 78
union
Select '002', '王大锤', 69
Union
Select '003' , '张三丰', 999
Declare @Names Varchar(128)
Select @Names = ISNULL(@Names + ',', '') + Name From Userinfo
print @Names