Go to dba[mssql article] accumulate Kuibu line thousands of miles

Source: Internet
Author: User
Tags mssql

In the original: Toward Dba[mssql Article] Kuibu line thousands of miles

I don't know if you're interested in the SQL series. First, find a way here. The reader for SQL rookie welcome Daniel Refutation or supplement

Since it is the Pathfinder article first, the data filtering in the partial door matching hope to bring you a harvest

CREATE TABLE Bug's temporary table (   number varchar (01),   name varchar (+),   Note varchar) Insert the temporary table values for the into bug Name01 ', ' This is a miracle ') insert into Bug's temporary table values (' numbered ', ' name02 ', ' This is a myth ') insert into Bug's temporary table values (' numbered 039 ', ' name039 ', ' This is a talk about ')--% everyone understands the select * from Bug's temporary table where number like '% number% '--use ' _ ' to match any character select * from Bug's temporary table where number like ' number 0_ '--use ' _ '  With any character but only matches any single character select * from Bug's temporary table where number like ' number _ '--match any character with ' _ ' but only match any single character if you want to represent 2 characters you can use ' __ ' SELECT * from Bug's temporary table Where number like ' # __ ' drop table Bug's Temp

The "_" wildcard function is similar to "%", except that "_" represents any single character, and that character can match only one character.

CREATE TABLE Bug temporary table (   nickname varchar (+),   seat number int,   note varchar) INSERT INTO Bug's temporary table values (' Harmony ', 15, ' It's a miracle ') Insert into Bug's temporary table values (' characteristic socialism ', 29, ' This is a myth ') insert into Bug's temporary table values ('%#¥ ', 31, ' This is a talk ') insert into bug temporary table values ('  Qg%q ', 31, ' This is a talk ')--' [] ' matches a character in a range select * from the Bug's temporary table where seat number like ' [1-2][1-9] '--' [^] ' matches characters not in a range select * from Bug's temp table Where seat number like ' [^1-2]_ '--Match Special character select * from Bug's temporary table where nickname like '%[%#]% '--use escape character in pattern query Escapeselect * from Bug's temporary table wher E nickname like '%g%% ' escape '/' drop table Bug ' Temp

The "[]" wildcard character is used to specify a series of characters, as long as one of these characters is satisfied, and the position appears at the "[]" wildcard where the string satisfies the query criteria. "[^]" to exclude specified data. The LIKE keyword can be combined with the "[]" wildcard to match Special characters or can be implemented using the Escape keyword and the escape character.

The next section and the detailed introduction of downstream standard.

Go to dba[mssql article] accumulate Kuibu line thousands of miles

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.