In an extract I am dealing with, I have 2
You can simply add the two.
Time partof your
Datecolumn is always zero
Date partof your
Timecolumn is also always zero (base date: January 1, 1900)
Adding them returns the correct result.
SELECT Combined = MyDate + MyTime FROM MyTable
It works like this due to the way the date is stored as two 4-byte `Integers` with the left 4-bytes being the `date` and the right 4-bytes being the `time`. Its like doing $0001 0000 + $0000 0001 = $0001 0001
Time are types introduced in
SQL Server 2008. If you insist on adding, you can use
Combined = CAST(MyDate AS DATETIME) + CAST(MyTime AS DATETIME)
Have a look at How to combine date and time to datetime2 in SQL Server? to prevent loss of precision using SQL Server 2008 and up.