Thank this author by sharing:
By Goce Smilevski,
While it's not likely that many of you need to find prime numbers using T-SQL, it is an interesting ...
"Trying to create a sp that prints Prime numbers upto 500"
Generates prime numbers and puts them into a table for future reference by adhoc queries and databas...
Very simple and straightforward script that creates a temporary table and fills it with prime number...
Select prime numbers
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.