Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have two columns like
start date enddate
2013-02-12 2013-03-13
2013-04-15 2013-04-23
2013-05-12 2013-06-24

I want output like

start date enddate moc
2013-02-12 2013-03-13 feb,mar
2013-04-15 2013-04-23 apr
2013-05-12 2013-06-24 may,june


How can i do this in SSRS
Posted

make a formula field and put this in it

=MonthName(Month(Fields!startdate.Value)) + "," + MonthName(Month(Fields!enddate.Value))
 
Share this answer
 
Comments
kasthurihariprasad 19-Jun-14 0:03am    
IT DOESN'T WORK IF THERE ARE 3 MONTHS BETWEEN STARTDATE AND ENDDATE.I HAVE 3 MONTHS BETWEEN STARTDATE AND ENDDATE.
you can do this on sql dataset,
something like this:

DECLARE @SDATE DATE
DECLARE @EDATE DATE
DECLARE @a varchar(max)=''
DECLARE @MLIST TABLE
(MName VARCHAR(30))
SET @SDATE = '2015-01-20' --first parameter
SET @EDATE = GETDATE() --second
WHILE (@SDATE < @EDATE)
BEGIN
INSERT INTO @MLIST
SELECT DATENAME(month,@SDATE)

SET @SDATE = DATEADD(MONTH,1,@SDATE)
END



SELECT @a=@a + MName +',' FROM @MLIST
select left(@a,len(@a)-1)



this work fine!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900