DATETIME2FROMPARTS function – SQL Server Denali

We have one more new date time function in Denali. DATETIME2FROMPARTS is the function name which is used to returns datetime2 value for the input value given.  If the arguments are not valid then an error is raised or if the argument is NULL then it will return a NULL value. This function is to precise, not sure how frequently we will use this function to get datetime2 value.

Syntax is below

DATETIME2FROMPARTS ( year, month, day, hour, minute, seconds, fractions, precision )

Lets try it with example

SELECT DATETIME2FROMPARTS(2011,09,02,23,55,9,5664,4)






Leave a Reply

Your email address will not be published. Required fields are marked *