Archive: barcode

 

Just found this MySQL snippet for validating EAN numbers.
http://snipplr.com/view.php?codeview&id=17928
I have modified it a bit to suit my requirements (namely totally corrupted EAN data).
PLAIN TEXT
SQL:

SELECT ean

FROM products

WHERE

(LENGTH(ean) != 13)

||

(SUBSTRING((10 - ((((

SUBSTRING(ean FROM 2 FOR 1) +

SUBSTRING(ean FROM 4 FOR 1) +

SUBSTRING(ean FROM 6 FOR 1) +

SUBSTRING(ean FROM 8 FOR 1) +

SUBSTRING(ean FROM 10 FOR 1) +

SUBSTRING(ean [...]



 

EAN13 is a barcode format. It consists of 12 numbers which you will generally have a range assigned to you. The 13th digit is called the check digit and is formulated by loooking at the other 12 digits. The purpose of the check digit is to ensure that the number is being read correctly as [...]