Skip to content
Advertisement

Convert SQL Server DateTime object to BIGINT (.Net ticks)

I need to convert a DateTime type value to BIGINT type in .Net ticks format (number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001).

The conversion should be perform in Sql server 2008 using T-SQL query

For example:

will convert to:

Advertisement

Answer

I have found a CodeProject article that may assist: Convert DateTime To .NET Ticks Using T-SQL

I enclose the SQL function from the above article (I hope this is ok? As it requires registration.)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement