declare @str varchar(200) set @str='' -- 必须先赋值 select @str=@str+cast(tb.[objid] as varchar(10))+',' from( select [objid],sfrq from tablename ) tb order by tb.sfrq print @str
declare @str varchar(200) set @str='' -- 必须先赋值 select @str=@str+cast(tb.[objid] as varchar(10))+',' from( select [objid],sfrq from tablename ) tb order by tb.sfrq print @str