RSS Feed

DATETIMEFROMPARTS()

DATETIMEFROMPARTS()

DATETIMEFROMPARTS(): The SQL Server 2012 enhancement includes DATETIMEFROMPARTS method which can be used to return a complete Date & Time (as single unit) from the given different input parameters as values. Parameters should be given correctly otherwise it will raise an error.

Syntax of DATETIMEFROMPARTS():

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

Example of DATETIMEFROMPARTS():

SELECT DATETIMEFROMPARTS(2012,10,31,22,50,20,0 ) AS 'Output';

The output will be shown as: 2012-10-31 22:50:29.000

For complete post go to SQL Server 2012 Enhancements.