But what if you need to fit them back together as a DATETIME?
SELECT CAST(CAST(mydate AS DATE) AS DATETIME) + CAST(mytime AS TIME) FROM [dbo].[mytable]
I'm sure there are other ways, I'd be interested to hear them, and any performance differences they provide!
Ref :
http://stackoverflow.com/questions/700619/combine-the-date-in-one-field-with-time-of-another-field-ms-sql-server
No comments:
Post a Comment