Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15174

Why not use VarChar(8000) always?

$
0
0
I know this is likely to be an answered question, but I can't figure out the reason why. It seems like I should always determine the maximum possible length encountered, add a small safety margin, and set my number of bytes to that. But I don't understand why. It seems like VarChar(8) is treated the same as VarChar(8000).
If strings are stored end to end with no gaps between their variable lengths and moved if the size changes, why do I need to set a limit? I could see that if I was storing ZIP codes and some are ZIP+4 then I might limit to 10 just as a validation. I.E., if someone tries to store something longer than 10, there's something wrong with it. But data integrity (validation) rules aside, if I have a field for street address why set it to 100 instead of 1000 or 8000 even? What performance reason is there for making it less than 8000?

Viewing all articles
Browse latest Browse all 15174

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>