从 SQL Compact 中的日期时间中选择时间 [英] Select time from datetime in SQL Compact
问题描述
很像这个问题:"How to get Time fromSQL 中的日期时间格式?",我试图从日期时间中选择仅时间,但与上述问题不同,我想知道如何在 SQL 中执行此操作服务器压缩
.有人知道怎么做吗?
Much like this question: "How to get Time from DateTime format in SQL?", I am trying to select only the time from a datetime, but unlike the above question, I would like to know how to do it in SQL Server Compact
. Does anyone know how to do this?
推荐答案
解决了.Luigi 的答案实际上不是正确的答案,但我对它投了赞成票,因为它帮助我找到了答案.
Solved it. Luigi's answer is not actually the correct one but I have upvoted it, as it helped me find the answer.
要仅从 SQL Server Compact
中的日期时间获取时间,正确的查询是:
To get only the time from a datetime in SQL Server Compact
, the proper query is:
select ltrim(str(DATEPART(hour, columnName))) + ':' + ltrim(str(DATEPART(minute, columnName))) + ':' + ltrim(str(DATEPART(second, columnName))))) 来自表
这篇关于从 SQL Compact 中的日期时间中选择时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!