Return the position of a pattern in a string:
SELECT PATINDEX('%schools%', '91xjr.com');
Try it Yourself »
The PATINDEX() function returns the position of a pattern in a string.
If the pattern is not found, this function returns 0.
Note: The search is case-insensitive and the first position in string is 1.
PATINDEX(%
pattern%,
string)
Parameter | Description |
---|---|
%pattern% | Required. The pattern to find. It MUST be surrounded by %. Other wildcards can be used in pattern, such as:
|
string | Required. The string to be searched |
Works in: | SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
---|
Return the position of a pattern in a string:
SELECT PATINDEX('%s%com%', '91xjr.com');
Try it Yourself »
Return the position of a pattern in a string:
SELECT PATINDEX('%[ol]%', '91xjr.com');
Try it Yourself »
Return the position of a pattern in a string:
SELECT PATINDEX('%[z]%', '91xjr.com');
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!