Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

SQL Scripts & Samples

Posted Nov 23, 1998

sp_modulus-10.sql

By DatabaseJournal.com Staff



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



SQL Scripts & Samples Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
SQL Scripts & Samples Forum
Topic By Replies Updated
sql help!! add 1 August 22nd, 11:58 AM
How To Combine These 2 Queries into 1 Query ? tarek_land 1 June 7th, 08:37 AM
solving query svibuk 1 February 3rd, 06:08 AM
converting from a character string to uniqueidentifier saturnius 4 January 4th, 05:56 AM