March 18, 2015 at 10:12 am
this is what i have for a query but i would like to take the year off. is there a way i can just have the month and day without the year attached?
March 18, 2015 at 10:23 am
You can use datepart to extract the month, and day, and then concatenate them together.
cast( datepart(mm, mydatecolumn) as char(2)) + '/' + cast( datepart(dd, mydatecolumn) as char(2))
March 18, 2015 at 10:30 am
Steve Jones - SSC Editor (3/18/2015)
You can use datepart to extract the month, and day, and then concatenate them together.cast( datepart(mm, mydatecolumn) as char(2)) + '/' + cast( datepart(dd, mydatecolumn) as char(2))
Alternatively
select convert(char(5), mydatecolumn,101)
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 18, 2015 at 10:46 am
Thanks it worked like a charm 🙂
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply