You really need to post ddl and sample data. I posted it for you this time.
You can use a tally table here to fill in the "missing" months. You can read about tally tables here. http://www.sqlservercentral.com/articles/62867/
This produces the output you want.
set dateformat mdy
if OBJECT_ID('tempdb..#Student') is not null
drop table #Student
create table #Student
select 1, 'Mike', '4/8/2013', '6/16/2013' union all
select 1, 'Mike', '6/18/2013', '8/26/2013' union all
select 2, 'John', '1/29/2014', '4/8/2014' union all
select 3, 'Andy', '4/10/2014', '6/18/2014'
select StudentID, StudentName, left(DATENAME(month, DATEADD(month, N - 1, 0)), 3) as [Month]
from #Student s
join Tally t on t.N >= month(StartDate) and t.N <= month(enddate)
group by StudentID, StudentName, left(DATENAME(month, DATEADD(month, N - 1, 0)), 3), DATEADD(month, N - 1, 0)
order by StudentID, DATEADD(month, N - 1, 0)
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's splitter
.Cross Tabs and Pivots, Part 1 – Converting Rows to Columns Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs Understanding and Using APPLY (Part 1)Understanding and Using APPLY (Part 2)