hey all
I just need someone who can explian to me what the ESCAPE keyword does here ??
nd what the deference if I remove it ??

SELECT employee_id, last_name, job_id
FROM   employees 
WHERE  job_id LIKE '%SA\_%' ESCAPE '\';

note working on the sample database SQL developers

An "escape" character is used when you need to tell the program that the next character needs special interpretation. For example, "\n" is generally interpreted as a newline character rather than as "\" and "n". In some cases, you need to tell the program what character (in my example it was "\") you want to use as the "escape" character. So by adding

ESCAPE '\'

You are telling the program that the character following "\" is to be treated differently than usual. In SQL, "" is a wildcard which matches any single character. If you actually want to match "" then you have to tell SQL to treat it diffently than as a wildcard.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.