How to obtain the content length of the text field in the SQL Server database

Source: Internet
Author: User

SQL ServerDatabaseObtain the content length of the text field.What about it? This article introduces SQL
The server database obtains the content length of the text field throughDatalengthFunction. Next we will use the syntax of the datalength function and the example to learn about this part.

 

Datalength is used to return the number of bytes occupied by any expression.

Syntax: datalength (expression)

Parameter: ExpressionAny type of expression.

Return type: int

Note: datalength applies to varchar, varbinary, text, image, nvarchar, and ntext
Data types are especially useful because they can store variable-length data. The result of null datalength is null.

 

 

Returns the number of characters in a character expression. If the string contains leading and trailing spaces, the function will include them in the count. Len returns the same value for the same single-byte and double-byte strings.

Len(Character_expression ),String expression

 


 

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.