Friday, September 9, 2011

SQL Server Denali: DateFromParts()

DateFromParts() is a new function introduced in SQL Server Denali. It takes three input parameters Year, Month and Day and returns value in Date format. 
Syntax: DateFromParts(Year, Month, Day)

There are 5 more functions related to DateTime introduced in SQL Server Denali.

TimeFromParts() function returns output in TIME format.
Syntax: TimeFromParts(Hour, Minute, Seconds, Fractions, Precision)

SmallDateTimeFromParts() function returns output in SmallDateTime2 format.
Syntax: SmallDateTimeFromParts(Year, Month, Day, Hour, Minute)

DateTimeFromParts() function returns output in DATETIME format.
Syntax: DateTimeFromParts( year, month, day, hour, minute, seconds, milliseconds)

DateTime2FromParts() function returns output in DATETIME2 format.
Syntax: DateTime2FromParts(Year, Month, Day, Hour, Minute, Seconds, Fractions, Precision)

DateTimeOffSetFromParts() function returns output in datetimeoffset format.
Syntax: DateTimeOffSetFromParts(Year, Month, Day, Hour, Minute, Seconds, Fractions, Hour_offset, Minute_offset, Precision)

No comments:

Post a Comment