Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
parand
Starting Member
8 Posts |
Posted - 2008-04-24 : 06:55:48
|
Hi,Does anyone know how to convert a datetime stamp to MMMYY format?As an example suppose a SQL enquiry returns:Date Value01/01/2008 1010/01/2008 1515/01/2008 25I want to be able to return:Date ValueJan08 50Many thanks in advance for your help. |
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-04-24 : 07:03:47
|
forgetting the whole 'formatting' bit for a sec, it seems what you really want is to group by the month...?something like...select DATEADD(mm,DATEDIFF(mm,0,[Date]),0),sum(value)from urTablegroup by DATEADD(mm,DATEDIFF(mm,0,[Date]),0)Em |
 |
|
parand
Starting Member
8 Posts |
Posted - 2008-04-24 : 10:51:02
|
Thanks very much ElanCaster and your suggestion is deeply appreciated.I have managed to produce the required result by combination of convert and substrings functions availabe. |
 |
|
|
|
|