Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

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

By Sergio Govoni,

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.

Total article views: 1861 | Views in the last 30 days: 1
 
Related Articles
SCRIPT
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...

Tags
barcode    
scalar udf    
t-sql    
ucc/ean    
 
Contribute