What is the data type for barcodes? What is the data type for barcodes? sql sql

What is the data type for barcodes?


Try to pick the most appropriate data type. If you're using actual product barcodes, a little research indicates that they're likely International Article Numbers.

Since they're really strings of 13 digits, a char(13) would probably be the most appropriate data type to store this data. Don't just default to varchar(50) because that's "big enough" - think of the length specification as free validation.


This is called E notation which is a variation of scientific notation. The number in question is an integer, but is abbreviated.

5.06 * 10^12 = 5060190000000

Thus, your value should be stored as an integer large enough to store your number.

Your value should be stored as a varchar long enough to fit the length of potential values.