In SQL, if you want to perform a SELECT with a wildcard, you\'d use:
SELECT * FROM table_name WHERE field_name LIKE \'%value%\'
If you wanted t
you can use join with like statement like below query:
SELECT * FROM table_name t
JOIN dbo.Split('one,two,three',',') s ON t.field_name LIKE N'%'+s.item+'%'
I create this function to split string:
CREATE FUNCTION [dbo].[Split] (@StringToSplit NVARCHAR(MAX), @SpliterChar CHAR(1))
RETURNS
@returnList TABLE ([item] [NVARCHAR] (500))
AS
BEGIN
DECLARE @nItem NVARCHAR(500);
DECLARE @pos INT;
WHILE CHARINDEX(@SpliterChar, @StringToSplit) > 0
BEGIN
SELECT @pos = CHARINDEX(@SpliterChar, @StringToSplit);
SELECT @nItem = SUBSTRING(@StringToSplit, 1, @pos-1);
if (@nItem <> '') INSERT INTO @returnList SELECT @nItem;
SELECT @StringToSplit = SUBSTRING(@StringToSplit, @pos+1, LEN(@StringToSplit)-@pos);
END
if (@StringToSplit<>'') INSERT INTO @returnList SELECT @StringToSplit;
RETURN
END