Percent character (wildcard - character(s) to match) (Transact-SQL)
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance
Matches any string of zero or more characters. This wildcard character can be used as a prefix, a suffix, or in the middle of the string. The pattern string can contain more than one %
wildcard.
Examples
Example A: Match end of string
The following example returns the first and last names of people in the Person.Person
table of AdventureWorks2022
, where the first name starts with Dan
.
SELECT FirstName, LastName
FROM Person.Person
WHERE FirstName LIKE 'Dan%';
GO
Example B: Match middle of string
The following example returns the first and last names of people in the Person.Person
table of AdventureWorks2022
, where the first name starts with J
and ends with n
.
SELECT FirstName, LastName
FROM Person.Person
WHERE FirstName LIKE 'J%n';
GO
See also
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για