Combination of Date and Time Column in SQL
I was tasked to create a system from an existing system. The old system database table is shown below:
Code:
Date Time ID
5/4/2009 00:00:00 1899/12/30 07:55:30 84321
How can I query the above example to something like this?
Code:
DateTime ID
5/4/2009 07:55:30 84321
I try to do this using this query:
Code:
select Date + Time as 'DateTimeRecord', ID from transdata
But unfortunately the result is this:
Code:
DateTime ID
5/2/2009 07:55:30 84321
Re: Combination of Date and Time Column in SQL
What you are getting looks to me like exactly what you are asking for so I can't be clearly understanding the problem.
Re: Combination of Date and Time Column in SQL
Look at using Convert, Convert to Varchar for the date portion getting just the date, then again for the time portion getting just the time. Contact the two pieces together then convert all back to a datetime.