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

Leave a comment

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



Related Posts

Batch script to deploy multiple SQL files
I was working on a project where I’m supposed to deploy lots of SQL Server script files (.sql). It’s very tedious job either to manually execute ...
Performance View on INNER JOIN and OUTER JOIN
Hope you guys are getting ready for Diwali Festival :-). Before you guys start with the festival event I thought of writing an article on perform...
Synonyms - SQL Server
I was working in a project where we are using database mirroring as high availability solution. In the same instance we have multiple databases i...
powered by RelatedPosts