Mode match in SQL Server

xiaoxiao2021-03-06  59

Author: David Eulerdate: 2004/11 / 17email: DE_EULER-David@yahoo.com There is any problem, please contact me:) SQL Server Books Online Search Like, found%, _, [], [^ ] Several wildcards. Such as: Select * from mybbs where content is used to search for strings that match a mode, or date, time value. Part of the SQL Server books is explained below:

Pattern matching in search conditions

.................................... ...Claizes.

WildcardMeaning% Any string of zero or more characters._Any single character. [] Any single character within the specified range (for example, [af]) or set (for example, [abcdef]). [^] Any single character not within The Specified Range (for Example, [^ a - f]) or set (for example, [^ Abcdef]).

ENCLOSE The Wildcard (s) and the character string in single quotation marks, for example:

LIKE '% en%' searches for all strings that contain the letters en anywhere in the string (Bennet, Green, McBadden). LIKE '_heryl' searches for all six-letter names ending with the letters heryl (Cheryl, Sheryl). LIKE 'Searches for Carsen, Karsen, Carson, And Karson (CARSON). Like' [MZ] INGER 'Searches for All Names Ending with the letters inger thing begin with any single letter from m thrtough z (^). Like 'm [^ c]%' Searches for All Names Beginning with the Letter M That Do Not Have The Letter C As The Second Letter.

THIS Query Finds All Phone Numbers in The Authors Table That Have Area Code 415:

SELECT Phone

From pubs.dbo.authors

WHERE Phone Like '415%'

转载请注明原文地址:https://www.9cbs.com/read-90813.html

New Post(0)