是啊,为什么要这样呢?
DECLARE @Names VARCHAR(8000) SELECT @Names = COALESCE(@Names + ', ', '') + ISNULL(Name, 'N/A') FROM People
为什么要这样干呢?不是有更简单的方式么?
declare @NameList nvarchar(2000) set @NameList = '' select @NameList = @NameList + name + ',' from 查询表 print substring(@NameList,0,len(@NameList)-1)
@imluzhi: 呵...