0

What will happen if I won't add max length to a column in MSSQL?

4

This is 100% an education problem for your developers and that is where this needs to be addressed.

Not specifying variable column length is a bad idea that will probably break almost immediately for you. Spoiler: it gives severely small lengths to the column.

Similarly, using MAX as the length by default is also a bad idea and will set you up for performance and architectural challenges down the line.

You should stick to using the smallest variable length fields that fit your business requirements and do some sessions with your developers to ensure they understand how SQL Server handles variable length data types, or check their work more closely in pull requests.

In the case where you have already tried this (which I hope is not the case) I have written a script sp_sizeoptimiser that flags occurrences of this problem to help you root out and remove them.

Not the answer you're looking for? Browse other questions tagged or ask your own question.