Du kan prova:
DECLARE @HOURS decimal(7,4) = 20.5599
SELECT CAST(CONVERT(VARCHAR,DATEADD(SECOND, @HOURS * 3600, 0),108) AS TIME)
utgång :20:33:35
Men kom ihåg:Skriv tid i MSSQL endast under 24 timmar
Om du vill ha mer än 24 timmar, försök:
DECLARE @HOURS decimal(7,4) = 25.5599
SELECT
RIGHT('0' + CAST (FLOOR(@HOURS) AS VARCHAR), 2) + ':' +
RIGHT('0' + CAST(FLOOR((((@HOURS * 3600) % 3600) / 60)) AS VARCHAR), 2) + ':' +
RIGHT('0' + CAST (FLOOR((@HOURS * 3600) % 60) AS VARCHAR), 2)
utgång :25:33:35
-- Uppdatera
Decimalminuter till mer än 24 timmar
DECLARE @MINUTES decimal(7,4) = 77.9
SELECT
RIGHT('0' + CAST (FLOOR(COALESCE (@MINUTES, 0) / 60) AS VARCHAR (8)), 2) + ':' +
RIGHT('0' + CAST (FLOOR(COALESCE (@MINUTES, 0) % 60) AS VARCHAR (2)), 2) + ':' +
RIGHT('0' + CAST (FLOOR((@MINUTES* 60) % 60) AS VARCHAR (2)), 2);
utdata:01:17:54