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.
Calculate the check digit for the UCC/EAN code equal to "0800123456789"
DECLARE @RES INT
EXEC @RES = UDF_GetCheckDigitUCCEAN '0800123456789'
The result is: 7.
The UCC/EAN code with check digit is: '08001234567897'.
SQL Script compatible with Microsoft SQL Server 2000.