varchar (n), nvarchar (n) Description of length, performance, and space occupied

Source: Internet
Author: User

varchar (n), n in nvarchar (n) how to interpret:
nvarchar (n) can store up to n
characters without distinguishing between Chinese and English.
  varchar (n) can store up to n bytes , and one Chinese is two bytes.

Occupied space:
nvarchar (n) is a character that takes up two bytes of space.
varchar (n) Chinese accounts for two bytes of space in English.

Value range of N:
The range of nvarchar (n) n is: between 1 and 4000
The range of varchar (n) n is: between 1 and 8000

Whether the size of n affects performance:
The length n in varchar and nvarchar does not affect space size and performance. Unless N is max and the content is greater than 4000 or 8000
Set N More is the business needs, such as restricting the ID card can only enter 18 digits, then more error, or prevent malicious attacks to support the hard drive. No impact on space or performance

varchar (n), nvarchar (n) Description of length, performance, and space occupied

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.