In an extract I am dealing with, I have 2 datetime
columns. One column stores the dates and another the times as shown.
How can I query the table to combine these two fields into 1 column of type datetime
?
Dates
2009-03-12 00:00:00.000
2009-03-26 00:00:00.000
2009-03-26 00:00:00.000
Times
1899-12-30 12:30:00.000
1899-12-30 10:00:00.000
1899-12-30 10:00:00.000
Convert the first date stored in a datetime field to a string, then convert the time stored in a datetime field to string, append the two and convert back to a datetime field all using known conversion formats.
Convert both field into DATETIME :
and if you're using
Getdate()
use this first: