CONVERTING MONTH NUMBER TO MONTH NAME IN REPORTING SERVICES
I WANT TO CONVERT THE MONTH NUMBER ENTERED AS A PARAMETER TO MONTH NAME IN A COLUMN .....HELP PLZ
September 25th, 2009 12:23am

You could simply define an expression for your column like=Iif(Parameters!Month_Number.Value = 1, "January", Iif(Parameters!Month_Number.Value = 2, "February", ...)))))))))))Or you could simply translate your month number in the query direclty by building a similar calculated field.Hope this helpsThierry D'hers [MS], This posting is provided "AS IS" with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
September 25th, 2009 1:21am

You can use one more option of using a switch function something like:=Switch(Parameters!Month_Number.Value = 1, "January", Parameters!Month_Number.Value = 2, "February"................)Regards,Raju
September 25th, 2009 1:32am

I USED THE CODE DATENAME (MONTH, I.FBT_END_DATE) AS 'MONTH END' TO DISPLAY THE MONTH NAME FROM THE DATE FBT_END_DATE BUT THE ERROR IS The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value . ANY HELP PLZ
Free Windows Admin Tool Kit Click here and download it now
September 25th, 2009 1:56am

Can you post some sample datas that you are getting in the column FBT_END_DATE.Regards,Raju
September 25th, 2009 2:00am

01/04/2008 31/03/2009 00/00/0000 THANKING YOU RAJU
Free Windows Admin Tool Kit Click here and download it now
September 25th, 2009 2:08am

Better to go with populating the data from querySQL sample:Select casemonth(Date_Column)when 1 then 'January'when 2 then 'February'when 3 then 'March'when 4 then 'April'when 5 then 'May'when 6 then 'June'when 7 then 'July'when 8 then 'August'when 9 then 'September'when 10 then 'October'when 11 then 'November'when 12 then 'December'end [Months]from [Table_Name] karthikshanth
September 25th, 2009 2:12am

01/04/200831/03/200900/00/0000THANKING YOU RAJU I see the third value is the one which is giving error '00/00/0000'. Is this value valid in your scenario.Regards,Raju
Free Windows Admin Tool Kit Click here and download it now
September 25th, 2009 2:19am

YES.OF COURSE...ACTUALLY I M TESTING ON THE TEST DATAS AND ITS ALRIGHT FORMAT
September 25th, 2009 2:31am

The problem here is '00/00/0000'. If you put your query as datename(month,'00/00/0000'), It will try to figure out the month name for the value 00 which is not existing as a result you are getting out of range error.One option would be checking for a valid date and if the date is invalid you can display the results as 'N\A'. Here is an Example of how to check for valid dates and assiging some value if it is invalid: Select Case when IsDate(FBT_END_DATE) = 0 Then 'N/A' Else Datename(month,FBT_END_DATE) ENDNote: When IsDate function returns 0 then it means it is an invalid date.Regards,Raju
Free Windows Admin Tool Kit Click here and download it now
September 25th, 2009 3:04am

cnsuman,Your original question: "I WANT TO CONVERT THE MONTH NUMBER ENTERED AS A PARAMETER TO MONTH NAME IN A COLUMN .....HELP PLZ"So, user typed in 12, you want to show in the report textbox as December, right? Simply use =MonthName(Parameters!mthnbr.Value)If you are going to show the month name of a datefield from your resultset, then use Format. Example:=Format(Fields!FBT_End_Date.Value,"MMMM") <-- will give you December=Format(Fields!FBT_End_Date.Value,"MMM") <-- will give you Dec=Format(Fields!FBT_End_Date.Value,"MM") <-- will give you 12hth.Chicagoan ...
September 25th, 2009 10:14am

use MonthName ex: MonthName(Month("06/01/1999")) or MonthName(6) will both return JuneLidia D.
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2012 11:07am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics