We help IT Professionals succeed at work.
Get Started

Nvarchar(max) versus nvarchar(4000)

1,721 Views
Last Modified: 2012-08-13
I'm creating a custom questionnaire and I have a text field in a table. Sometimes it may only store text 15 chars long and sometimes it may store text 4000 characters long.

I want to use an nvarchar() column.

I read:
>>the default setting for NVARCHAR(MAX) is to store its text value in the table structure, unless the text is over 8,000 bytes at which point it behaves like an NTEXT and stores the text value in the LOB , and stores a pointer to the text in the table.

Does this only apply if it is defined as nvarchar(max) ? Or can I define it as nvarchar(4000) and still store according to the above?

What would be the best way to define a variable length text field and have it store data the best possible way?

thanks.
 
Comment
Watch Question
Top Expert 2011
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE