Reputation: 1055
I am running the below query and would like to convert the column 'JVDATE' into just showing the month.
Query:
SELECT
FISCALYEAR, JVDATE, ACCOUNTNUMBER, ACCOUNTDESCRIPTION,
CATEGORY, POSTINGTYPE, AUDITTRAIL,
ORIGDOCNUMBER, ORIGDEBIT, ORIGCREDIT, ORIGNETAMOUNT
FROM
SRVS.dbo.vw_GLTrialBalancev2010
When I run the query I get .....
What is the easiest way to do this?
Many thanks,
Upvotes: 0
Views: 44
Reputation: 239684
Do you maybe want DATENAME
?
SELECT ..., DATENAME(Month,JVDate) as Month,....
(Or, if you want it as a numeric value, as per @Amit's answer, I'd usually go with the DATEPART
function, since it applies to all component parts rather than having to find specific functions for each component)
Upvotes: 2