Short answer: Yes.
What does it mean if someone passed a username whose length was 2147,483,647 characters !? Using varchar (max), you mean that everything will be fine.
I agree with the comment by @DanGuzman. Column columns must be sized appropriately in the first place, then parameters and variables must be appropriately. If you need to resize a table column, then you should propagate this change elsewhere - this is a best practice approach.
Sorting table columns correctly is not always easy - how long should the username be? 12 seems short, 2,147,483,647 is definitely too long - somewhere in the middle ?;) @JohnCappelletti also has a valid point - storage and handling are cheap compared to change costs, so be wrong on the big side when calibrating.
If varchar (max) is bad and you don't want to follow best practice, is there a midpoint? Maybe use a factor of 10? Something is sufficiently higher than the actual size, but not excessive.
Another thing you need to pay attention to, regardless of how you evaluate your parameters, is silent truncations or truncation errors at runtime - explicitly check the lengths.
source share