This a modification to the script given by Preethi.
It generates prime numbers to the upper bound you specify.
Modifications are using following facts from algebra:
1. All prime numbers greater than 3 can be written in the form 6 * X +/- 1.
2. Instead of checking the module for ALL numbers <= FLOOR(SQRT(@aX)), it is enough to check PRIME NUMBERS ONLY.
Also, the check is done using SQL on @Prime table, instead of a WHILE-loop.
Write Reports from SQL to Disk (Even HTML!)
Ever need to write reports out to a folder? I have found that creating output files are SA-WEET! (and easy too) The sample script uses BCP to create an HTML file.This process works well for reports that need to be generated nightly and take too long to run in real time. Use an SMTP mail […]