Misconception about nvarchar(max)

I had a stupid misconception about nvarchar(max) for a couple years now, and it was a shock, when it came down.

Some say, that nvarchar(max) is the same as nvarchar(4000). It is exactly that, and you can not store more, than 4000 characters in it.

But thats not true.

The basics of this is MSSQL normally stores the nvarchar(max) data in an nvarchar(4000) place, BUT if you have a data bigger than that, this storage will become a pointer, and MSSQL will store it outside of the table. It will make it slower to search, harder to index, but it will store the data.

It’s important, because it will still be faster, than ntext.

Leave a Reply

Your email address will not be published. Required fields are marked *