Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert date to ticks in SQL Server

Does anyone know how to convert a DATETIME COLUMN to TICKS in SQL Server?

like image 531
FinalDestiny Avatar asked May 23 '10 16:05

FinalDestiny


1 Answers

If you are trying to have t-sql convert a value to ticks that can be compared with the "same" value created in .NET it will not work. A DateTime data type in SQL Server only has a precision of about .003 seconds (actually values are rounded to .000, .003 or .007) or 10-3 whereas a DateTime data type in .NET has a precision of 100 nanoseconds (10-7).

like image 104
Thomas Avatar answered Nov 14 '22 11:11

Thomas