SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

How to calculate the check digit for a UCC/EAN code

By Sergio Govoni, 2008/07/08

Total article views: 958 | Views in the last 30 days: 26

The standard coding of UCC/EAN requires that each code generated ends with a check digit between zero and nine (0 - 9).

The check digit is calculated in according to the other digits that make up the code and its purpose is to ensure that the bar code is interpreted correctly by the optical scanner.

Example:

Calculate the check digit for the UCC/EAN code equal to "0800123456789"

DECLARE @RES INT

EXEC @RES = UDF_GetCheckDigitUCCEAN '0800123456789'
PRINT (@RES)

The result is: 7.

The UCC/EAN code with check digit is: '08001234567897'.

SQL Script compatible with Microsoft SQL Server 2000.

By Sergio Govoni, 2008/07/08

Total article views: 958 | Views in the last 30 days: 26
Your response
 
 
Related Articles
FORUM

mod 10 weights 1, 2

check digit calcualtion

FORUM

Add Check Digit (LUHN)

Comments posted to this topic are about the item [B]Add Check Digit (LUHN)[/B]

SCRIPT

Add Check Digit (LUHN)

If you ever need to create a credit card like number this stored procedure is for you. Most credi...

ARTICLE

Digital Storage

Digital technologies have made the transfer of information easier than ever, but what about it's lon...

FORUM

Check Digit calc

Hi all i'm looking for a script (udf) to calculate check digits, this is for standard food product ...

Tags
barcode    
scalar-valued functions    
t-sql    
ucc/ean    
 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com