Types of SQL Server strings

Source: Internet
Author: User

The SQL Server string is divided into different types, and you will be presented with a few common types of SQL Server strings that you can use to help you learn SQL Server strings.

NChar

This data type can store 1~4000 fixed-length Unicode strings, string lengths are specified at creation time, and default to nchar (1) if unspecified. Each character occupies 2bytes of storage space.

varchar

This data type can store variable long strings with a maximum value of 8,000 characters. The maximum length of a variable-length string is specified at creation time, such as varchar (50), with each character occupying 1byte of storage space.

nvarchar

This data type can store a variable-length Unicode string with a maximum value of 4,000 characters. The maximum length of a variable-length Unicode string is specified at creation time, such as nvarchar (50), with each character occupying 2bytes of storage space.

Text

This data type stores variable-length text with a maximum value of 2,147,483,647 characters, and does not need to specify its initial value, each character occupies 1byte of storage space, and is typically used to store large sections of the article. The text data type is actually a large object data type, by default, this type of data is not stored in the data row, but instead is stored on a separate large object data page. In addition, the text data type cannot be used as a parameter in a function, stored procedure, or trigger.

Types of SQL Server strings

Related Article

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.