This piece of code depends on you having a present table with prime numbers ranging from 2 to 3037000493.DECLARE @Number BIGINTSET @Number = 2020208534430421SELECT Prime AS Number, CAST(1 AS TINYINT) AS ItemsINTO #TempFROM PrimesWHERE Prime <= SQRT(@Number) AND @Number % Prime = 0WHILE @@ROWCOUNT > 0 UPDATE #Temp SET Items = Items + 1, @Number = @Number / Number WHERE @Number % Number = 0SELECT Number, ItemsFROM #TempUNION ALLSELECT @Number, 1WHERE @Number > 1DROP TABLE #Temp
N 56°04'39.26"E 12°55'05.63"