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:
DateTime value - 12/09/2011 00:00:00
will convert to:
BIGINT value - 634513824000000000
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.)