Hi Friends,
I have 2 display month between 2 dates
For eg.I have StartDate=1/1/2011 and EndDate=15/5/2011
It will display me:
January February March April May
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Feb 4, 2011, 2:45 PM
ShankeyPosted Feb 3, 2011, 2:26 AM
Hope this will help you,
Declare
@sd date,
@ed date
begin
set @sd=CONVERT(date,'1/1/2011');
set @ed=CONVERT(date,'5/15/2011');
while (@sd < @ed)
begin
SELECT DATENAME(month, @sd)
SET @sd = DATEADD(MONTH,1,@sd);
End
End
Thanks,
Shankey