Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between varchar and nvarchar in sql

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Sql in what is the difference between varchar and nvarchar, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Q: what's the difference between varchar and Nvarchar in sqlserver? varchar seems to have two bytes in both English and Chinese characters, while Nvarchar takes up one byte in English and two bytes in Chinese characters. But what effect does this have on asp programs? Answer: varchar (n) character data that is n bytes in length and is not Unicode in length. N must be a number between 1 and 8000. The storage size is the actual length of the bytes of the input data, not n bytes. Nvarchar (n) contains variable length Unicode character data of n characters. The value of n must be between 1 and 4000. The storage size of bytes is twice the number of characters entered. The two fields have field values, respectively: me and coffee, then the varchar field accounts for 2 × 2 bytes of storage space, while the nvarchar field accounts for 8 × 2 bytes of storage space. For example, you can choose varchar if the field value is only in English, and use nvarchar when the field value has more double-byte characters (Chinese, Korean, etc.)

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report