Link to home
Start Free TrialLog in
Avatar of RichardKline
RichardKline

asked on

Why does T-SQL SELECT WHERE (DATA LIKE '_2_%') retrieve DATA = '_244_1' ?

The T-SQL statement
SELECT  [DATA]
  FROM DATABASE
WHERE (DATA LIKE '_2_%')

Retrieves values like _244_1 , _26_1 and _268_1.

Shouldn't it only pick up values like _2_1 and _2_abc ?

Thank you,
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For your case try

WHERE (DATA LIKE '[_]2[_]%')
Avatar of RichardKline
RichardKline

ASKER

Gosh, do I feel silly.

Thanks!