declare @tttt char(),@tt
declare ccptable cursor for select distinct 类别名称 from table order by 类别编码
open ccptable
fetch ccptable into @tttt
while @@fetch_status=0
begin
set @tt= isnull(@tt,'') + ' ' + @tttt
fetch ccptable into @tttt
end
close ccptable
deallocate ccptable
end
select @tttt
@tttt 就可以得到
船舶编码 航修费 备件费 优钢.缆绳.篷布...
不过我估计你不是仅仅为了得到这串字符串,您的问题还没有描述清楚。
declare ccptable cursor for select distinct 类别名称 from table order by 类别编码
open ccptable
fetch ccptable into @tttt
while @@fetch_status=0
begin
set @tt= isnull(@tt,'') + ' ' + @tttt
fetch ccptable into @tttt
end
close ccptable
deallocate ccptable
end
select @tttt
@tttt 就可以得到
船舶编码 航修费 备件费 优钢.缆绳.篷布...
不过我估计你不是仅仅为了得到这串字符串,您的问题还没有描述清楚。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货