> For the complete documentation index, see [llms.txt](https://qatesting.gitbook.io/qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qatesting.gitbook.io/qa/database-testing/sql/wildcard-character.md).

# Wildcard Character

#### Wildcard Characters in SQL Server

<table data-full-width="true"><thead><tr><th width="92.33333333333331">Symbol</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>%</td><td>Represents zero or more characters</td><td>bl% finds bl, black, blue, and blob</td></tr><tr><td>_</td><td>Represents a single character</td><td>h_t finds hot, hat, and hit</td></tr><tr><td>[]</td><td>Represents any single character within the brackets</td><td>h[oa]t finds hot and hat, but not hit</td></tr><tr><td>^</td><td>Represents any character not in the brackets</td><td>h[^oa]t finds hit, but not hot and hat</td></tr><tr><td>-</td><td>Represents any single character within the specified range</td><td>c[a-b]t finds cat and cbt</td></tr></tbody></table>

Here are some examples showing different `LIKE` operators with '%' and '\_' wildcards:

<table data-full-width="true"><thead><tr><th>LIKE Operator</th><th>Description</th></tr></thead><tbody><tr><td>WHERE CustomerName LIKE 'a%'</td><td>Finds any values that starts with "a"</td></tr><tr><td>WHERE CustomerName LIKE '%a'</td><td>Finds any values that ends with "a"</td></tr><tr><td>WHERE CustomerName LIKE '%or%'</td><td>Finds any values that have "or" in any position</td></tr><tr><td>WHERE CustomerName LIKE '_r%'</td><td>Finds any values that have "r" in the second position</td></tr><tr><td>WHERE CustomerName LIKE 'a__%'</td><td>Finds any values that starts with "a" and are at least 3 characters in length</td></tr><tr><td>WHERE ContactName LIKE 'a%o'</td><td>Finds any values that starts with "a" and ends with "o"</td></tr></tbody></table>
