better way than like
Posted on 2008-10-07
been messing with some code
this does exactly what I want
(',' + c.ParentID + ',' LIKE '%,'+ @ParentID +',%')
but don't want to use LIKE
this doesn't work - doesn't return records where there are more than one in the list:
@ParentID IN (c.ParentID)
this doesn't work - it times out:
@ParentID IN (Select value from dbo.ParmsToList(c.ParentID,','))
dbo.parmstolist is a function to turn a list like 2,5,7 into '2','5','7'
c.ParentID is a varchar column whose value might be "2,5,7"
@ParentID might be 5