How can i pass a string delimited by space or comma to stored procedure and filter result? I\'m trying to do something like -
Parameter Value
----------
You could try something like:
select firstname, lastname from @test t1
inner join persondata t on t.firstname like '%' + t1.x + '%' or t.lastname like '%' + t1.x + '%'
group by firstname, lastname
having count(distinct x) = (select count(*) from @test)
where @test is the table with results of your split. If you have lots of columns in persondata, you might want to just return an ID from this query, and use it as a subquery for the one that actually returns data, so you don't have to group by so many columns.
Edit: you could also use a cursor and another temp table/table variable, but I have kind of an allergic reaction to cursors in SPs.