Using The TSQL DATEPART Function

Here is a quick video training on how to use the T-SQL DATEPART function on SQL Server. This was originally part of my free SQL query training for the 70-461 certification exam. And here is the sample code to go with the

Posted in 70-461 Training, TSQL Tagged with: , ,


You can use the TSQL DATEPART function to extract individual parts of the date from a date or time item. For instance: Will return the following output:   The second parameter is the date/time element which can be any of

Posted in SQL Server, TSQL Tagged with:


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

Posted in TSQL Tagged with: , , , , ,

TSQL Rounding or Truncating DateTime to Nearest Day, Hour, Minute or Second

One thing that I end up having to look search on regularly is rounding of dates and times in Transact SQL, having looked this up too many times I finally realized that it is time for me to do my

Posted in TSQL Tagged with: , ,