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

86 reads

Blogs

Goal Progress for July 2021

By

I set goals at the beginning of the year, and I’m tracking my progress...

Data Modeling at your fingertips

By

(2021-July-30) A picture is worth a thousand words, the same way a visual database schema...

How to put a SQL Server Database into Recovery Pending

By

You might be asking why on earth would you want to get a database...

Read the latest Blogs

Forums

Migrate SQL Sever 2012 Database To Server 2014 and Subsequent Versions

By VSCurtis

Hi Guys, I have an SQL Server 2012 Express database that I would like...

Deploying SQL Server Automatically

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Deploying SQL Server Automatically

Setting data compression on a database or even server level possible?

By DiStas

I well realize data compression is a subject to a few variables, such as...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers