日期:2014-05-18 浏览次数:20559 次
drop function dbo.fn_secondstr go create function dbo.fn_secondstr (@second int) returns varchar(16) as begin declare @hour int, @minu int, @scnd int, @str varchar(16) set @hour = (@second / 3600) set @minu = (@second / 60)%60 set @scnd = (@second %60) set @str = cast(@hour as varchar)+'"'+cast(@minu as varchar)+''''+cast(@scnd as varchar) return @str end go select dbo.fn_secondstr(126) -- 0"2'6
------解决方案--------------------
varchar()
------解决方案--------------------
直接存varchar,不易使用max,min,avg等统计函数