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

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