Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Casting VARCHAR as DATE

$
0
0

Hi all..

A relatively simple query I am sure, and it may be one I have asked previously so I apologise. My SQL work sometimes has a few months break!

I have a field in my Source Data known as Accounting_Month- this is made up of 7 characters, namely month/full year e.g.

01/2015 = Jan 2015
02/2015 = Feb 2015

and so on...

When I select that field it outputs as 01/2015, 02/2015 etc. but what I'd like to do is convert the output of the above from VARCHAR so that it outputs 01/2015 as Jan 15, 02/2015 as Feb 15, and so on.

Does anyone have any simple steps to do this?

I am eventually going to use it in an SSRS report so if it's easier, can I format it once I am at the point of designing my report rather than trying to do this in the SQL? If so, how?!

Thanks very much (smiley face)

Glenn


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>