Is there a simple way to convert seconds (integer) number into the format hh:mm:ss format in SQL2000 query analyzer?try this...
declare @.h int, @.m int, @.s int
set @.s = 9003
set @.h = @.s/360
set @.s = @.s - (@.h * 360)
set @.m = @.s / 60
set @.s = @.s - (@.m * 60)
select right("00" + cast(@.h as varchar),2) + ":" + right("00" + cast(@.m as varchar),2) + ":" + right("00" + cast(@.s as varchar),2)|||Originally posted by vkaramched
Is there a simple way to convert seconds (integer) number into the format hh:mm:ss format in SQL2000 query analyzer?
Hi vkaramched, Try This.
Declare @.pvsSeconds INT
Set @.pvsSeconds = 4754395
CASE WHEN (@.pvsSeconds/3600) <=9 THEN '0' ELSE '' END + CONVERT(VARCHAR, (@.pvsSeconds/3600)) + ':' + RIGHT('100' + CONVERT(VARCHAR, (@.pvsSeconds%3600)/60),2) + ':' + RIGHT('100' + CONVERT(VARCHAR, @.pvsSeconds%60),2)
Cheers,
Gola Munjal
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment