Got it

Differences between GaussDB 100 VARCHAR() and NVARCHAR()

Created: Jul 31, 2019 13:20:28Latest reply: Jul 31, 2019 13:23:53 476 1 0 0 0
  Rewarded HiCoins: 0 (problem resolved)

Differences between GaussDB 100 VARCHAR() and NVARCHAR()

Featured Answers
TingtingGG
Created Jul 31, 2019 13:23:53

Hey there!

Differences between VARCHAR() and NVARCHAR()

Definition

nvarchar(n): Variable length Unicode character data containing n characters. The value of n must be between 1 and 4,000. The size of a byte is twice the number of characters entered. The length of the entered data character can be zero.

varchar(n): A variable-length and non-Unicode character data whose length is n bytes. n must be a value between 1 and 8,000. The storage size is the actual length of the byte of the input data, not n bytes. The length of the entered data character can be zero.

Differences

In storage mode, nvarchar is stored by [character], while varchar is stored by [byte]. In terms of storage capacity, varchar saves space because the storage size is the actual length of bytes, while nvarchar is dual-byte storage. If the stored contents are English characters and no other language symbols such as Chinese characters are used, you are advised to use varchar

nvarchar is used for Chinese characters, because nvarchar uses Unicode encoding, that is, unified character encoding standard, which reduces the occurrence probability of garbled characters. If your project may involve conversion between different languages, you are advised to use nvarchar.
View more
  • x
  • convention:

All Answers
Hey there!

Differences between VARCHAR() and NVARCHAR()

Definition

nvarchar(n): Variable length Unicode character data containing n characters. The value of n must be between 1 and 4,000. The size of a byte is twice the number of characters entered. The length of the entered data character can be zero.

varchar(n): A variable-length and non-Unicode character data whose length is n bytes. n must be a value between 1 and 8,000. The storage size is the actual length of the byte of the input data, not n bytes. The length of the entered data character can be zero.

Differences

In storage mode, nvarchar is stored by [character], while varchar is stored by [byte]. In terms of storage capacity, varchar saves space because the storage size is the actual length of bytes, while nvarchar is dual-byte storage. If the stored contents are English characters and no other language symbols such as Chinese characters are used, you are advised to use varchar

nvarchar is used for Chinese characters, because nvarchar uses Unicode encoding, that is, unified character encoding standard, which reduces the occurrence probability of garbled characters. If your project may involve conversion between different languages, you are advised to use nvarchar.
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.