Technical Article

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

You rated this post out of 5. Change rating

2003-07-01

88 reads

Blogs

My 2024 in Data: Health and Workouts

By

This is my last week of the year working (I guess I come back...

My 2024 in Data: Reading

By

This is my last week of the year working (I guess I come back...

Book Review – Agile Data Warehouse Design

By

I recently read the book Agile Data Warehouse Design – Collaborative Dimensional Modeling, from...

Read the latest Blogs

Forums

Need ADF pipeline suggestion to copy 1 million files

By varunkum

I have an ADF pipeline that copies Files from source to destination. Both Source...

Backup issues

By Bruin

I''m running a stripped backup (2 files) to a Network share. It's a 32gig...

Function Defaults

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Function Defaults

Visit the forum

Question of the Day

Function Defaults

I have created this function in SQL Server 2022:

CREATE FUNCTION dbo.AddInt (@one INT, @two INT = 1) RETURNS INT
AS
BEGIN
    RETURN @one + @two
END
How can I call this and invoke the default value for @two?

See possible answers