In my SP, I need to work with a string that could be up to 40 characters.
Would it make a difference if I use VARCHAR(4000)
instead of VARCHAR(40)
?
Update:
The reason I'm asking this question is that to my understanding the memory usage of a VARCHAR(4000)
and VARCHAR(40)
variable is the same. I'm trying to figure out why should I limit myself to a VARCHAR(40)
variable? Why not VARCHAR(4000)
? Is it because performance or memory efficiency?
Update 2, Important assumption:
I assume when we store the string "Hello World" in a variable with either of VARCHAR(4000)
or VARCHAR(40)
types, it takes the same amount of memory. Am I right?