WHERE au_lname LIKE 'de%' finds all author last names starting with de and where the following letter isn't l.Ī character put in front of a wildcard character to indicate that the wildcard is interpreted as a regular character and not as a wildcard. In range searches, the characters included in the range may vary depending on the sorting rules of the collation.Īny single character not within the specified range or set. WHERE au_lname LIKE 'arsen' finds author last names ending with arsen and starting with any single character between C and P, for example Carsen, Larsen, Karsen, and so on. WHERE au_fname LIKE '_ean' finds all four-letter first names that end with ean ( Dean, Sean, and so on).Īny single character within the specified range or set. WHERE title LIKE '%computer%' finds all book titles with the word computer anywhere in the book title. If match_expression is a higher precedence data type than pattern, and the pattern length is greater than match_expression, you will get a truncation error during the implicit conversion of pattern value to match_expression type. The specific string of characters to search for in match_expression, and can include valid wildcard characters in the following table. Arguments match_expressionĪny valid expression of character data type. To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation. Syntax for Azure Synapse Analytics and Parallel Data Warehouse: match_expression LIKE patternĮSCAPE and STRING_ESCAPE are not supported in Azure Synapse Analytics or Analytics Platform System (PDW). Syntax for SQL Server and Azure SQL Database: match_expression LIKE pattern If any one of the arguments isn't of character string data type, the SQL Server Database Engine converts it to character string data type, if it's possible. Using wildcard characters makes the LIKE operator more flexible than using the = and != string comparison operators. However, wildcard characters can be matched with arbitrary fragments of the character string. During pattern matching, regular characters must exactly match the characters specified in the character string. A pattern can include regular characters and wildcard characters. Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)ĭetermines whether a specific character string matches a specified pattern.
0 Comments
Leave a Reply. |