Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 431 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the maximum characters for the NVARCHAR(MAX)?

#1
I have declared a column of type `NVARCHAR(MAX)` in SQL Server 2008, what would be its exact maximum characters having the MAX as the length?
Reply

#2
The max size for a column of type `NVARCHAR(MAX)` is 2 GByte of storage.

Since `NVARCHAR` uses 2 bytes per character, that's approx. 1 billion characters.

Leo Tolstoj's *War and Peace* is a 1'440 page book, containing about 600'000 words - so that might be 6 million characters - well rounded up. So you could stick about 166 copies of the entire *War and Peace* book into each `NVARCHAR(MAX)` column.

Is that enough space for your needs? :-)
Reply

#3
>By default, nvarchar(MAX) values are stored exactly the same as nvarchar(4000) values would be, unless the actual length exceed 4000 characters; in that case, the in-row data is replaced by a pointer to one or more seperate pages where the data is stored.

If you anticipate data possibly exceeding 4000 character, nvarchar(MAX) is definitely the recommended choice.

Source:

[To see links please register here]

Reply

#4
From [MSDN Documentation][1]

> **nvarchar** [ ( n | **max** ) ]
>
> Variable-length Unicode string data. _n_ defines the string length and can be a value from 1 through 4,000. **max** indicates that the maximum storage size is 2^31-1 bytes (2 GB).
The storage size, in bytes, is two times the actual length of data entered + 2 bytes

[1]:

[To see links please register here]

Reply

#5
I think actually `nvarchar(MAX)` can store approximately 1070000000 chars.

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through