August 21, 2009 at 9:51 am
I have a set of data which Carries along dates with it.
I want to display data according to month names.
sAMPLE dATA
215NULL3110102009-07-17 00:00:00.00067
216test2210102009-08-17 23:59:03.61067
224Test11810102009-08-18 01:37:12.61367
224Test21910102009-08-18 01:37:12.61367
288Test Message21810102009-08-19 11:27:07.09767
289NULL1810102009-08-19 11:30:10.28067
August
----------
Data
July
------------
Data
August 21, 2009 at 10:10 am
Using LEFT(@date,3) gets you a 3 character abbreviation for the month name, or you could create a table
to look up up the name to go with the number returned by DATEPART(Month,@date).
However, doing the formatting you want (NAME/Underscore/Data) is not readily done in T-SQL. All T-SQL will do is return a rowset that has the month name stored in a column along with the rest of the data. The data can of course be ordered by month name. But the calling application will have to test for a month change, print a blank line, printmonth name all by itself, print a set of rows which do not display the month name, etc. Sorry.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply