Here is a quick rundown on the T-SQL DATEPART function for SQL Server. DATEPART is used to pull a single part of a date/time element out as shown below. The following query uses DATEPART to extract the year from the datetime input. The following query uses DATEPART to extract the quarter from the datetime input. The following query uses DATEPART …

T-SQL DATEPART Explained Read more »