Here are two nice scripts for checkdigit calculation. I work as a consultant for a paneuropean mailorder company so my work is just a bit biased towards that end. They are written for MSSQL Server 6.5 but both should work on 7.0 as well. The first is the standard modul-10 algorithm used among other things for the check digit on credit cards.

BTW If anyone’s interested I have more algorithms for credit card validation (number of digits, checking which brand the card is (Visa, Mastercard, Maestro, Diners, JCB) etc).

The second is the less usual modul-11 algorithm which is used by the European mail for parcel-id-numbers for parcel-tracking.

You are a assigned a parcelid series by the national mail for example 501233000 to 501239999 and you have to pick a new (sequential) number from this series for each new parcel you want to send out by mail, add a checkdigit (module-11) and prepend a prefix (usually the ISO country code) and sometimes append a suffix. Remember to raise an alarm when the maximum for your allocated series is beginning to close in, and to abort once your series have been fully used (you need to have a new series allocated to you).

For SQL Server 6.5

Author: Uwe Janke

Download Script:


We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Latest Articles