DATETIMEFROMPARTS function – SQL Server Denali

This function is new to SQL Server denali to return datetime value from the input given. This function is similar to DATETIME2FROMPARTS  however here we don’t have fractions and precision argument instead we have milliseconds argument here.  If the arguments are not valid then an error is raised or if the argument is NULL then it will return a NULL value.

Syntax is below

DATETIMEFROMPARTS ( year, month, day, hour, minute, seconds, milliseconds )

Lets try with example

SELECT DATETIMEFROMPARTS(2011,09,02,23,55,9,54)






Leave a Reply

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