Thursday, August 29, 2013

Making a datetime2 field from a Date and Time element

This needs more documentation but I'm tired of remembering this

CAST(ReceiveDate AS NVARCHAR(10)) + ' ' + CAST(ReceiveTime AS NVARCHAR(16))

To make a datettime2:
CONVERT(datetime2, CAST(ReceiveDate AS NVARCHAR(10)) + ' ' +  CAST(ReceiveTime AS NVARCHAR(16)))

No comments: