November 14, 2009 at 12:02 pm
I am grouping the data by Month and Year in sql. Using that I am getting as Date CONVERT ( CHAR(6),i_date, 112 ). This is giving me 200806. I want it in the format 06/2008. Is there any way to do it.
November 14, 2009 at 1:59 pm
"i_date" smells like an integer, right?
Try this:
SELECT SUBSTRING(CONVERT(VARCHAR(12), CONVERT(DATETIME, CONVERT(CHAR(6),i_date) + '01'), 103), 4, 7)
Greets
Flo
(PS: What's wrong with storing dates as DATETIME those days on SSC?)
November 14, 2009 at 6:57 pm
Old COBOL programmers who can't learn new tricks?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy