SMALLDATETIMEFROMPARTS function in SQL Server Denali

Today I’m going to give you a short demo on the new date time function in SQL Server Denali. It’s SMALLDATETIMEFROMPARTS function, are you able to get the things from naming convention. Yep! you are right, this function will return small datetime value with the parts of data being supplied to the function. I hope previously we did this with convert or cast function.

Syntax is below

SMALLDATETIMEFROMPARTS ( year, month, day, hour, minute )

Lets do a try

SELECT SMALLDATETIMEFROMPARTS ( 2055, 08, 12, 12, 53 )

smalldatetimefromparts

If you provide invalid arguments then error will be thrown. Lets say if you provide a value greater than 12 in month argument then it will fail to construct the smalldatetime value


Posted

in

by

Comments

One response to “SMALLDATETIMEFROMPARTS function in SQL Server Denali”

  1. SQL-Articles » SMALLDATETIMEFROMPARTS function in SQL Server Denali…

    Thank you for submitting this cool story – Trackback from DotNetShoutout…

Leave a Reply to DotNetShoutout Cancel reply

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