December 10, 2011 at 12:01 am
Hi All
In Sql Server Db2005
record is like give below
Column-YearMonthNumber of dayHospital Name Address
Value-20101212 Ramana Hospital test test test
In UI month value is display as December
I have to write query for this Month value instead of 12 i have to display December
pls advice me with query.
December 10, 2011 at 12:48 am
This is the least flexible way to do it:
case month when 1 then 'January'
when 2 then 'February'
when 3 then 'March' --etc
end MonthName
December 10, 2011 at 9:36 am
Hi ,
thanks for reply
i wrote the query
i used dateadd funciton
DateAdd( month , @Monthnumber, 0 ) - 1 )
Regards,
firoz
December 11, 2011 at 6:54 am
As a side bar, storing dates as separate columns for Year, Month, and Day normally creates more problems than it's worth especially when it comes to future aggregations for reporting. My recommendation would be to store the date as a full DATETIME and have persisted calculated columns that separate the date into Year, Month, and Day if you really need them for reporting purposes.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply