ALTER FUNCTION [dbo].[GetPreCertStatus] ( -- Add the parameters for the function here @Start Datetime, @End Datetime, @DayLimit Int ) RETURNS TABLE AS RETURN ( -- Add the SELECT statement with parameter references here with cte as (select case when @Start IS NOT NULL and @End IS NOT NULL THEN 'Settled' WHEN @Start IS NOT NULL and @End IS NULL then case when @DayLimit < (SELECT COUNT(*) FROM dbo.Calendar WHERE isWeekday = 1 AND isHoliday = 0 AND dt >= cast(@Start as date) AND dt < cast(GETDATE() as date)) THEN 'Overdue' else 'Pending' END ELSE -- what else is not covered ? 'Pending' END as StatusDescr) select StatusDescr, case StatusDescr WHEN 'Settled' then 2 when 'Pending' then 1 when 'Overdue' then 3 end as [Status] from cte )How can I change this logic to check for 48 hours accurate to the second?