SQL(服务器)日期转换
我想将运行持续时间(从 msdb..sysjobhistory)转换为经过的秒数。持续时间存储为整数,例如
13 means 13 secs
213 means 2 mins and 13 secs = 133 secs
310213 means 31 hours, 2 mins and 13 secs = 111,733 secs
有什么巧妙的方法可以做到这一点吗?
它是 SQL Server 2000,但我更喜欢通用 SQL
I want to convert the run duration (from msdb..sysjobhistory) to an elapsed seconds figure. The duration is stored as an integer where for example
13 means 13 secs
213 means 2 mins and 13 secs = 133 secs
310213 means 31 hours, 2 mins and 13 secs = 111,733 secs
Is there any neat way of doing this?
It's SQL Server 2000 but I would prefer generic SQL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为没有任何简洁的 ANSI 方法可以做到这一点,甚至没有使用 SQL Server 2000 扩展的简洁方法。您可以按如下方式进行操作:
I don't think there is any neat ANSI way to do this, or even a neat way using SQL Server 2000 extensions. You can do it as follows: