Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 1caf7af

Browse files
committed
Percent character wildcard (PR 8370)
1 parent 48bdb0c commit 1caf7af

1 file changed

Lines changed: 38 additions & 27 deletions

File tree

docs/t-sql/language-elements/percent-character-wildcard-character-s-to-match-transact-sql.md

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ title: "Wildcard search (%)"
33
description: "Percent character (Wildcard - Character(s) to Match) (Transact-SQL)"
44
author: rwestMSFT
55
ms.author: randolphwest
6-
ms.reviewer: ""
7-
ms.date: "12/06/2016"
6+
ms.date: 12/19/2022
87
ms.service: sql
98
ms.subservice: t-sql
109
ms.topic: reference
11-
ms.custom: "seo-lt-2019"
10+
ms.custom: seo-lt-2019
1211
f1_keywords:
1312
- "%"
1413
- "%_TSQL"
@@ -22,29 +21,41 @@ helpviewer_keywords:
2221
dev_langs:
2322
- "TSQL"
2423
---
25-
# Percent character (Wildcard - Character(s) to Match) (Transact-SQL)
24+
# Percent character (wildcard - character(s) to match) (Transact-SQL)
25+
2626
[!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)]
2727

28-
Matches any string of zero or more characters. This wildcard character can be used as either a prefix or a suffix.
29-
30-
## Examples
31-
The following example returns all the first names of people in the `Person` table of `AdventureWorks2012` that start with `Dan`.
32-
33-
```syntaxsql
34-
-- Uses AdventureWorks
35-
36-
SELECT FirstName, LastName
37-
FROM Person.Person
38-
WHERE FirstName LIKE 'Dan%';
39-
GO
40-
```
41-
42-
## See Also
43-
[LIKE (Transact-SQL)](../../t-sql/language-elements/like-transact-sql.md)
44-
[Operators (Transact-SQL)](../../t-sql/language-elements/operators-transact-sql.md)
45-
[Expressions (Transact-SQL)](../../t-sql/language-elements/expressions-transact-sql.md)
46-
[[ ] (Wildcard - Character(s) to Match)](../../t-sql/language-elements/wildcard-character-s-to-match-transact-sql.md)
47-
[[^] (Wildcard - Character(s) Not to Match)](../../t-sql/language-elements/wildcard-character-s-not-to-match-transact-sql.md)
48-
[_ (Wildcard - Match One Character)](../../t-sql/language-elements/wildcard-match-one-character-transact-sql.md)
49-
50-
28+
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.
29+
30+
## Examples
31+
32+
### Example A: Match end of string
33+
34+
The following example returns the first and last names of people in the `Person.Person` table of `AdventureWorks2019`, where the first name starts with `Dan`.
35+
36+
```sql
37+
SELECT FirstName, LastName
38+
FROM Person.Person
39+
WHERE FirstName LIKE 'Dan%';
40+
GO
41+
```
42+
43+
### Example B: Match middle of string
44+
45+
The following example returns the first and last names of people in the `Person.Person` table of `AdventureWorks2019`, where the first name starts with `J` and ends with `n`.
46+
47+
```sql
48+
SELECT FirstName, LastName
49+
FROM Person.Person
50+
WHERE FirstName LIKE 'J%n';
51+
GO
52+
```
53+
54+
## See also
55+
56+
- [LIKE (Transact-SQL)](../../t-sql/language-elements/like-transact-sql.md)
57+
- [Operators (Transact-SQL)](../../t-sql/language-elements/operators-transact-sql.md)
58+
- [Expressions (Transact-SQL)](../../t-sql/language-elements/expressions-transact-sql.md)
59+
- [[ ] (Wildcard - Character(s) to Match)](../../t-sql/language-elements/wildcard-character-s-to-match-transact-sql.md)
60+
- [[^] (Wildcard - Character(s) Not to Match)](../../t-sql/language-elements/wildcard-character-s-not-to-match-transact-sql.md)
61+
- [_ (Wildcard - Match One Character)](../../t-sql/language-elements/wildcard-match-one-character-transact-sql.md)

0 commit comments

Comments
 (0)