sp_modulus-10.sql | Database Journal

sp_modulus-10.sql

Nov 24, 1998
2 minute read

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:
sp_modulus-10.sql

sp_modulo11.sql



Disclaimer:
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

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.