declare @s int
set @s = 246
declare @str varchar(20)
declare @hour int,@minitute int,@second int
select @hour = @s/60/60
select @minitute = (@s-@hour * 60)/60
select @second = @s - @hour * 60 * 60 - @minitute * 60
set @str = ''
if len(cast(@hour as varchar(10))) = 1
set @str = @str + '0' + cast(@hour as varchar(10)) + ':'
else set @str = @str + cast(@hour as varchar(10)) + ':'
if len(cast(@minitute as varchar(10))) = 1
set @str = @str + '0' + cast(@minitute as varchar(10)) + ':'
else set @str = @str + cast(@minitute as varchar(10)) + ':'
if len(cast(@second as varchar(10))) = 1
set @str = @str + '0' + cast(@second as varchar(10))
else set @str = @str + cast(@second as varchar(10))