Get current year in TSQL

datetime, sql, t-sql

Solution

Yes, it's remarkably easy in fact:

WHERE YEAR(A.[reimbursementDate]) = YEAR(GETDATE())

Problem

I have data I am trying to pull for a report and I am working on a Year to Date report. My columns in the table are formatted as datetime. I am trying to run a select statement to get all the results where date = this year. For example: ``` SELECT A.[id], A.[classXML] FROM tuitionSubmissions as A WHERE A.[status] = 'Approved' AND A.[reimbursementDate] = THISYEAR FOR XML PATH ('data'), TYPE, ELEMENTS, ROOT ('root'); ``` Is there an eay way to acomplish this?

Original source