Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下 sql 将小时转换为分钟,但它返回 0。为什么我会得到这个?
选择(日期部分(分钟,'05:00:00.0000000'))
返回 300
因为早上 5 点的分钟部分是 0 : 即 05: 00 :00
你想要类似的东西
select (datepart(minute, '05:00:00.0000000')) + (datepart(hour, '05:00:00.0000000')*60)
或者
select datediff(minute, 0, convert(time,'05:00:00.0000000'))