Posts

Showing posts from 2014

SQL 2012 - Newly Introduced Date and Time Functions

As a SQL developer we are always keen to find and understand new features that microsoft releases with each new versions may be sql or anyother microsoft packages. The functions mentioned in below articles are some of the new T-SQL Date and time functions introduced in SQL 2012. This should help in redcuing time in writting some of complicated date time queries in a simple manner. DATETIME2FROMPARTS Building on the DATETIME2FROMPARTS offers more precise DateTime2 data type, It contains fractions of a second to a specified precision. This means the syntax for the function will accommodate additional parameters for fractions and precision. The syntax for this function is DATETIME2FROMPARTS (year, month, day, hour, minute, seconds, fractions, precision). SELECT DATETIME2FROMPARTS (2014, 02, 18, 14, 23, 44, 50, 2) AS MyDateValue MyDateValue 2014-02-18 14:23:44.50 DATETIMEFROMPARTS DATETIMEFROMPARTS is similar to DATEFROMPARTS, except it returns a DateTime value, and not