GO
	SELECT dbo.FormatStatusMessage('Step 1b: Started.')
GO
	IF(dbo.FunctionExists('CombineTimestampAndFractionOfASecondAsTable') = 1)
		DROP FUNCTION [dbo].[CombineTimestampAndFractionOfASecondAsTable]
GO

	CREATE FUNCTION dbo.CombineTimestampAndFractionOfASecondAsTable
	(
		@Timestamp AS DATETIME
		, @FractionOfASecond AS REAL
	)
	RETURNS TABLE
	AS
		RETURN
		(
			SELECT DATEADD
			(
				NANOSECOND
				, @FractionOfASecond*1000000000
				, CONVERT(DATETIME2, @Timestamp)
			) AS [TimestampUTC]
		)
GO

	IF(dbo.FunctionExists('CombineTimestampAndFractionOfASecond') = 1)
		DROP FUNCTION [dbo].CombineTimestampAndFractionOfASecond
GO
	
	CREATE FUNCTION dbo.CombineTimestampAndFractionOfASecond
	(
		@Timestamp AS DATETIME,
		@FractionOfASecond AS REAL
	)  
	RETURNS DATETIME2 AS  
	BEGIN 
		RETURN DATEADD
		(
			NANOSECOND, 
			@FractionOfASecond*1000000000, 
			CONVERT(DATETIME2,@Timestamp)
		)
	END
GO

	SELECT dbo.FormatStatusMessage('Step 1b: Completed.')
GO