if object_id('tb') is not null drop table tb
go
create table tb(id int identity(1,1),startDate varchar(10),endDate varchar(10))
insert into tb(startDate,endDate) select '2013-01-01','2013-12-01'
go
declare @startDate varchar(10)
declare @endDate varchar(10)
select @startDate=startDate,@endDate=endDate from tb with(nolock)
select convert(varchar(10),dateadd(mm,number,@startDate),120) as [月份]
from master..spt_values with(nolock)
where type='P' and number>=0
and dateadd(mm,number,@startDate)<=@endDate
go
drop table tb
go
