I'm really missing the scope of this conversion :doze: ..
It sound likes this script is doing a large amount of CPU work for just change 8bytes into another 8byte representation.
If i would need a conversion from DateTime to BigInt why not just use something like:
select cast(cast(GETDATE() as timestamp) as bigint)
I'm pretty sure that sql will do this job in a better way than calling a lot of "datepart".
After all, i miss why the need of this conversion since a can actually put indexes on datetime columns too!
What am i wrong with? :doze: