Re: Surrogate Keys

From: Bernard Peek <bap_at_shrdlu.com>
Date: 2000/05/28
Message-ID: <6UuIrJA3mFM5Ewrb_at_shrdlu.com>#1/1


In article <392F539E.E1D93060_at_207.87.184.178>, Randy Yates <yates_at_207.87.184.178> writes

>> 4) Generate a random number with a check digit and use it as the key.
>
>You're over my head here. What's a check digit and why would we
>use this over a plain old autonumbered surrogate key?

A check digit is an extra digit added to the end of a string. It's calculated by applying a hashing function to the string. When you receive what you believe is a valid string you strip off the last character, reapply the hashing function then see whether you get a result that matches the check-digit. If they don't match then your data has been corrupted. Somewhere on the Borland/Inprise site there's a description of the algorithm used for the check-digit of the International Standard Book Number.

It's a really good idea if your key value is ever going to be transcribed by hand. It has limited value these days because most data is moved electronically and most transmission systems have their own error detection.

-- 
Bernard Peek
bap_at_shrdlu.com
bap_at_shrdlu.co.uk
bap_at_shrdlu.org.uk
Received on Sun May 28 2000 - 00:00:00 CEST

Original text of this message