• francesco.mantovani - Wednesday, April 12, 2017 3:09 PM

    This is exactly what I was looking for!
    You saved me a lot of work

    There is a faster version here: http://www.sqlservercentral.com/scripts/Prime+Numbers/155286/