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.
我得到一个 DT_DBTime 类型的时间列。(例如 05:00:21.0000000)。现在我需要将此时间列与特定时间段进行比较。但是,当我以这种方式编写时,它会显示错误:
[Time]>="05:00:00.0000000"&&[Time]<="05:01:00.0000000"
有什么方法可以比较时间值而不转换为字符串类型?
您应该能够转换您的字符串并以这种方式进行比较:
[Time] >= (DT_DBTime)"05:00:00.0000000" && [Time] <= (DT_DBTime)"05:01:00.0000000"
如果这不起作用,请尝试使用 CONVERT:
[Time] >= CONVERT(DATETIME,"05:00:00.0000000") && [Time] <= CONVERT(DATETIME,"05:01:00.0000000")