declare @s varchar(8000) 不够存怎么为
declare @i int
declare @s varchar(8000)
set @i = 2
set @s = 'select ImlImportCode,ImlProductId,ImlSize'
while exists (select * from xt_color where xtColorID= @i )
begin
select @s = @s + ',(case when imlcolor ='+ cast(@i as varchar)+ ' then
imlnum else 0 end) as ' +xtColorName from xt_color where xtColorID = @i
set @i = @i + 1
end
set @s = @s + ' from gc_importlist order by ImlId'
exec (@s)
有5行记录就出错
declare @s varchar(8000) 不够存怎么为