This function takes a number of Seconds in BIGINT format and calculations and displays that in a DDD:HH:MM:SS format.
I wrote this because I needed to work out the duration between two datetimes and required the result to be displayed in a Report (VARCHAR (12)) format from a Select statement
SELECT dbo.csp_SecondsToDaysHoursMinutesSeconds(DATEDIFF(SS, , )) AS Duration
Note 1: Time_2 must be > Time_1
Note 2: DDD is the number of days to a maximum of 999
For most DBAs, normalization is an understood concept, a bread and butter bit of knowledge. However, it is not at all unusual to review a database design by a development group for an OLTP (OnLine Transaction Processing) environment and find that the schema chosen is anything but properly normalized. This article by Brian Kelley will give you the core knowledge to data model.