Friday, September 19, 2008

Check the column value if value is in string format with coma separated using Sql

If column value is in 1,2,34,23,44,444,12,23,... format than how can check the value using like operator in Sql. means if the coma separated value is in column in any table then how can check the value using like operator in Sql.

solution:
select * from s
where
sid like '44,%' or sid like '%,44,%'
or sid like '%,44' or sid='44'

where sid is column name
this will only return the 44

No comments: