Adds TIME portion of a DT to the DATE of another

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 DATETIMESET @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:30AMPRINT dbo.FN_AddDateTime(@Date,0)RETURNS: Jul  1 2003 12:00AM

2003-07-01

84 reads

Blogs

Azure Data Engineer Associate

By

You can read about all the new role based qualifications from Microsoft here –...

Social: Going Along to Get Along

By

It’s the eve of the Fourth of July, when the Declaration of Independence is...

Daily Coping 3 Jul 2020

By

I’ve started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

Update table and then executeJob in loop

By khushbu

I need to write a query which will first update the table, then execute...

Using two different backup products for each of data and log

By Fal

  To shorten a long story, my organisation has decided to have a vendor...

Compare sql-2012 and sql-2016 settings

By rohitkocharda

Hi everyone, W are just doing a migration from sql 2012 enterprise  to sql...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers