Use of wildcard characters in SQL Server

Source: Internet
Author: User

Use of wildcard characters in SQL Server

Wildcard characters _

The "_" number represents any single character, and the symbol can match only one character. " _ "can be placed anywhere in the query condition and can only represent one character." A Chinese character is represented by only one "_".

Wildcard character%

The "%" symbol is a character match that can match a string of any length of 0 or more characters. In an SQL statement, you can place a% at any point in the query condition to represent a string of any length. You can also place two% queries when querying conditions, but it's best not to have two% in the query condition

wildcard characters []

"[]" can be used to query a certain range of data in a schema query. [] To specify any single character within a range, including both ends of the data

wildcard characters [^]

[^] is used to query any single character that does not belong to the specified range ([a-f]) or set ([abcdef]).

such as: SELECT * from Allcustomer

Where CustomerName like ' s[^abc]% '

Represents the query from the table Allcustomer that the user name begins with S, and the second character is not a,b,c information.

Use of wildcard characters in SQL Server

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.