This function returns a datetimeoffset value.
Syntax: DateTimeOffsetFromParts (year, month, day, hour, minute, seconds, fractions, houroffset, minuteoffset, precision)
Example 1: Simple example
Select DateTimeOffsetFromParts (2011,7,24,0,15,44,120,0,0,3) [Result]
/*
Result
2011-07-24 00:10:44.120 +00:00
*/
Example 2: Specifying all nulls
Select
DateTimeOffsetFromParts (null,null,null,null,null,null,null,null,null,null) [Result]
Msg 10760, Level 16, State 1, Line 1
Scale argument is not valid. Valid expressions for data type datetime2 scale argument are integer constants and integer constant expressions.
Example 3: Omitting mandatory fields will raise exception
Select DateTimeOffsetFromParts (2011,7,24,0,15,44,120) [Result]
Msg 174, Level 15, State1, Line1
The datetimeoffsetfromparts function requires 10 argument(s)
Hope this helps