Results 1 to 3 of 3

Thread: Escape sequence

  1. #1
    Join Date
    Aug 2004
    Posts
    5

    Unanswered: Escape sequence

    Hi,
    I have a question with this query -
    SELECT * FROM table1 WHERE column1 = 'T_C_%';

    This query returns rows where column1 = "T_Care", "T_CRP" etc etc, whereas I was expecting only rows where column1 = "T_C_Tail", "T_C_Head"

    However, when I use an escape character(/), the results are more in the lines of the expected results.

    Can somebody explain this?
    cheers/- Pradeep

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    In a LIKE expression, any underscore (_) matches any one character, and any percent sign (%) matches any group of characters. You can also use brackets ([]) to define sets of characters.

    See the BOL description of LIKE for more details.

    -PatP

  3. #3
    Join Date
    Aug 2004
    Posts
    5
    Thanks Pat, really appreciate your quick response.
    -Pradeep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •