Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I wondering is there any benefits of reducing the value limit?
Why we don't just give the (MAX) directly in any case
is that affects on the database or somthing?

What I have tried:

i used to do that
giving the max value what ever the length i need,
just give it nvarchar(MAX)
is that wrong?
Posted
Updated 16-May-17 7:53am
Comments
[no name] 16-May-17 9:27am    
What is it exactly that you would like us to tell you that a simple google search could not?
PIEBALDconsult 16-May-17 9:29am    
Yes, there is.

NVARCHAR(MAX) is stored on the database differently so that scenario is pretty clear.

I would think your question is more like "what is the difference between NVARCHAR(50) and NVARCHAR (500)?" assuming that 500 will nearly always hold what you need. It makes it confusing to see a field named last_name that is NVARCHAR (500). True, it won't make any difference internally to SQL but why give the impression that it can hold that much data and also what if you have a bug that ends up adding lots of data? You won't catch it right away.

If you are trying to decide between NVARCHAR (25) and NVARCHAR (50), then clearly go with 50 but don't do magnitudes higher than what you need. It just confuses people.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900