Like SQL Function
The Like() function takes 2 (two) arguments and performs pattern based search. In simple english explanation, LIKE (A, B) function will be as if A is equals to B then returns 1 for true, 0 for false.
The like function is different than LIKE Clause and performs case insensitive search.
Syntax for Like() function Like (Wildcard , String ).
Wildcards |
Description |
% |
Matches any number of characters including zero. |
_ |
Matches exactly one character. |
/* Following will return 1 */
SELECT Like('S%', 'SQLDatabase.Net');
/* Following will return 1 */
SELECT Like('S_LD%', 'SQLDatabase.Net');
/* Following will return 1 */
SELECT Like('%a\\_%', 'This is a\\ \\ string');