declare @string varchar(100) set @string = '' select @string = @string + FieldName + ',' from tablenameselect @string
哦,忘说了,是在ACCESS库中,有办法吗?
create table T(ID int, FieldName nvarchar(10)) insert T select 1, '高' union all select 2, '手' union all select 3, '请' union all select 4, '!'declare @str nvarchar(200) set @str='' select @str=@str+FieldName+',' from T order by ID select @str --result 高,手,请,!,(1 row(s) affected)
set @string = ''
select @string = @string + FieldName + ',' from tablenameselect @string
insert T select 1, '高'
union all select 2, '手'
union all select 3, '请'
union all select 4, '!'declare @str nvarchar(200)
set @str=''
select @str=@str+FieldName+',' from T order by ID
select @str
--result
高,手,请,!,(1 row(s) affected)