select number,isnull(sl,0.00)sl from master..spt_values a
left join #table b on a.number=b.year
where type='p'
and number in(2008,2013) --这里写条件组合
------解决方案-------------------- create table #table(year varchar(10),sl varchar(10))
insert into #table
select '2008','20.2'
union all select '2012','40.2'
union all select '2013','50.2'
select * from #table
declare @s varchar(1000)
set @s='2008,2013'
select * from #table
where case when @s='' then 1 else CHARINDEX(','+cast(year as varchar)+',',','+@s+',') end>0