CREATE TABLE vTable (id INT, NAME VARCHAR(100))
INSERT INTO vTable
SELECT 1,'Shamas Qamar' UNION ALL
SELECT 2,'Atif' UNION ALL
SELECT 3,'Kashif' UNION ALL
SELECT 4,'Imran'
DECLARE @vParam VARCHAR(100)
SET @vParam = 'Sha,hif'
SELECT * FROM vTable
CROSS APPLY (SELECT [value] FROM
dbo.fnSplit(@vParam,',')) b
dbo.fnSplit(@vParam,',')) b
WHERE NAME LIKE '%' + b.[VALUE] + '%'
DROP TABLE vTable
No comments:
Post a Comment