日期:2014-05-17 浏览次数:20444 次
create function getT(@id int)
returns nvarchar(50)
begin
declare @a nvarchar(50)
select @a=''
select @a=@a+t2+';' from test where t1=@id
return @a
end
select dbo.getT(1)
select * into #myTest from test with(nolock)
alter #myTest add lj varchar(500)
declare @lj varchar(500)
set @lj=''
while exists (select top 1 lj from #myTest where lj is null)
begin
select top(1000) * into #a from #myTest
update #myTest set lj=lj+ddd fom #a where #a.t1<#myTest.t1
drop table #a
drop table #myTest
end
有错误,自己改吧,大概这样可以实现