T-SQL,蜱,时间戳 [英] T-sql, ticks, timestamp

查看:145
本文介绍了T-SQL,蜱,时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能得到的东西C#一样在T-SQL DateTime.Ticks?

Is it possible to get something C# like DateTime.Ticks in t-sql ?

感谢帮助

推荐答案

这是不太可能,你就可以得到同样的精度了SQL作为DateTime.Ticks因为SQL但在没有前preSS时间那么多precision。 SQL Server只存储时间约为1 / 1/300秒,而单剔重presents百纳秒或千万分之一秒。

It's unlikely you'll be able to get the same kind of accuracy out of SQL as DateTime.Ticks since SQL doesn't express time in that much precision. SQL Server only stores time to approximately 1/300th of a second, whereas a single tick represents one hundred nanoseconds or one ten-millionth of a second.

SELECT DATEDIFF(s, '19700101', GETDATE()) 

上面的查询将让你一个Unix风格的时间戳,如果这样的作品,反而使我需要知道你正在使用的数据进行了任何实际的建议。如果你需要的分辨率比3毫秒的高,虽然,你需要看看SQL外部的。

The above query will get you a Unix-style timestamp if that works, but to make any real suggestions I'd need to know what you're using the data for. If you need higher resolution than 3 ms though, you need to look outside of SQL.

这篇关于T-SQL,蜱,时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆