Software Development Network>> SQL Server>> Breaking up parameters
=Year(Parameters!reportdate.Value)
I want the month to be displayed as November, January, July...etc not 11, 1, 7 '
=Month(Parameters!reportdate.Value) gives me 10 which I dont want
and
=MonthName(Parameters!reportdate.Value) gives me an error. I am using SQL 2000.
try the following
Switch(Month(Parameters!BeginDate.Value)=01,"January" & Year(Parameters!BeginDate.Value),Month(Parameters!BeginDate.Value)=02,"Feb" & Year( Parameters!BeginDate.Value) )
Breaking up parameters
GMohr
=Year(Parameters!reportdate.Value)
I want the month to be displayed as November, January, July...etc not 11, 1, 7 '
=Month(Parameters!reportdate.Value) gives me 10 which I dont want
and
=MonthName(Parameters!reportdate.Value) gives me an error. I am using SQL 2000.
leamas
try the following
Switch(Month(Parameters!BeginDate.Value)=01,"January" & Year(Parameters!BeginDate.Value),Month(Parameters!BeginDate.Value)=02,"Feb" & Year( Parameters!BeginDate.Value) )
Genyus
select DATENAME(m, @CurrentDate) + ' ' + DATENAME(yy, @CurrentDate)
is:
Column1
-------------------------------------------------------------
April 2006
No rows affected.
(1 row(s) returned)
That gives the month name (not number), as you requested...
TBJ
http://msdn.microsoft.com/library/default.asp url=/library/en-us/tsqlref/ts_da-db_1dph.asp
Also have a look at this article for some further examples:
http://www.sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk
Ray_GTI-R
http://msdn2.microsoft.com/en-US/library/ms174395(SQL.90).aspx
It's the documentation for the TSQL DATENAME command.
Polican
declare @CurrentDate datetime
set @CurrentDate = GetDate()
select DATENAME(m, @CurrentDate) + ' ' + DATENAME(yy, @CurrentDate)