What’s the difference between INT(2) and INT(20) ? Not a lot.
It’s about output formatting, which you’ll never encounter when
talking with the server through an API (like you do from most app
languages).
The confusion stems from the fact that with CHAR(n) and
VARCHAR(n), the (n) signifies the length or maximum length of
that field. But for INT, the range and storage size is specified
using different data types: TINYINT, SMALLINT, MEDIUMINT, INT
(aka INTEGER), BIGINT.
At Open Query we tend to pick on things like INT(2) when
reviewing a client’s schema, because chances are that the
developers/DBAs are working under a mistaken assumption and this
could cause trouble somewhere – even if not in the exact spot
where we pick on it. So it’s a case of pattern recognition.
A very practical example of this comes from a client I worked
with last week. I first spotted some harmless ones, we talked
about it, and then we hit …
[Read more]