like()

Scalar. Determines whether a given string matches a specified pattern string.

Syntax

like ( string, pattern )

Parameters

string

A string.

pattern

A pattern of characters, as a string. Can contain wildcards.

Usage

Determines whether a string matches a pattern string. The function returns 1 if the string matches the pattern, and 0 otherwise. The pattern argument can contain wildcards: '_' matches a single arbitrary character, and '%' matches 0 or more arbitrary characters. The function takes in two strings as its arguments, and returns an integer.

Note: In SQL, the infix notation can also be used: sourceString like patternString.

Example

like ('MSFT', 'M%T') returns 1.