SQLTeam.com | Weblogs | Forums

Sql like statement

sql2008

#1

Hey friends!! New here, can anyone help me with a simple query of mine.....
I have to select a number using like statement, for example:
These are the two data I have
401
301, 4012
when I run the query: select * from tablename where columnname like '%401%' it retrieves both the row, but I want just the first one... How to solve this?????


#2

Why just the first?


#3

select *
from tablename
where ',' + columnname + ',' like '%[^0-9]401[^0-9]%'