MS SQL Basics Tutorial: String functions

Source: Internet
Author: User

String functions perform different operations on binary data, strings, and expressions. This type of function acts on Char, VARCHAR, BINARY, and varbinary data types and data types that can be implicitly converted to char or VARCHAR. You can use String functions in the Select and WHERE clauses of a SELECT statement and in expressions. The common string functions are:

1. Character conversion function

There are several character conversion functions:

· ASCII ()

The ASCII () function returns the ASCII-code value of the leftmost character of a character expression. The ASCII () function syntax is as follows:

Example 4-40:

Reminder: In the ASCII () function, a string of pure digits can be used without ' enclosing ', but a string with other characters must be enclosed for use, otherwise there will be an error.

· CHAR ()

The CHAR () function is used to convert ASCII code to characters. The syntax is as follows:

If you do not enter an ASCII code value between 0 ~ 255, the CHAR () function returns a null value.

Example 4-41:

· LOWER ()

The LOWER () function converts the string to lowercase, with the following syntax:

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.