UDF that returns a DATETIME which is the concatination of the TIME portion of one DATETIME and the DATE portion of another.
EXAMPLES:
DECLARE @Date DATETIME, @Time DATETIME
SET @Date = '7/1/03 16:00'
SET @Time = '5/16/1999 9:30 AM'
PRINT dbo.FN_AddDateTime(@Date,@Time )
RETURNS: Jul 1 2003 9:30AM
PRINT dbo.FN_AddDateTime(@Date,0)
RETURNS: Jul 1 2003 12:00AM
2007-10-02 (first published: 2002-06-20)
15,451 reads