www.kevincornwell.com
SQL Server - How to combine 2 date and time columns into 1 column.

Sample columns

date_col:

2007-05-06 00:00:00.000

time_col:

1971-01-01 01:06:23.000

Use this…

DATEADD(hh ,DATEPART(hh, [time_col]]), DATEADD(n ,DATEPART(n, [time_col]) , DATEADD(ss ,DATEPART(ss, [time_col]) , [date_col])))

To get this…

2007-05-06 01:06:23.000

Comments RSS


Leave a comment:


Blog | Contact | Gallery | Links | Music | Sandbox | Search | SharePoint | Social Networking | Software | Weather | Web Design


Copyright © 1997-2008 KCSH. All rights reserved.