在sql Server 2008中,我在表中具有类型为DateTime的以下列.
+-------------------------+ | LTime | +-------------------------+ | 2009-12-07 10:40:21.893 | | 2009-12-07 10:42:18.173 | +-------------------------+
从上面的列中,我想选择日期时间并舍去毫秒,以获得以下输出
+---------------------+ | LTime | +---------------------+ | 2009-12-07 10:40:22 | | 2009-12-07 10:42:18 | +---------------------+
非常感谢您的帮助.
解决方法
是否
SELECT CAST('2009-12-07 10:40:21.893' AS DATETIME2(0)),CAST('2009-12-07 10:42:18.173' AS DATETIME2(0))
做你需要的吗?