Skip to content

Latest commit

 

History

History
 
 

Subtracting Two Dates

readme.md

Advanced SQL Puzzles

This directory contains the implementation details for a function that accurately subtracts two dates and parses the output into its various parts (Days, Hours, Minutes, Seconds, NanoSeconds).

In this directory you will find the following:


Subtracting Two Dates.pdf

Contains an overview of the date part functions.

FnDateDiffPartsChar.sql

Script to create the FnDateDiffPartsChar function. This is a scalar valued function that returns a varchar.

FnDateDiffPartsTable.sql

Script to create the FnDateDiffPartsTable function. This is a table valued function that returns an integer column for each date part.