I have a date filed 12/26/2006 and a time field 7:00am. How can I combine them in my select statement and get a DateTime field.
Using SQL Server?
SELECT CONVERT(VARCHAR(10), MyDateField) + Convert(VARCHAR(12), MyTimeField) As MyDateTimeField
FROM MyTable
I forgot to add a space between the date and time:
SELECT CONVERT(VARCHAR(10), MyDateField) + ' ' + CONVERT(VARCHAR(12), MyTimeField) As MyDateTimeField
FROM MyTable
What are exact definitions of those fields in database?
No comments:
Post a Comment