You can try something like this
check the occurances of the words required, and compare to the count of split words.
All issue i forsee is matches to partial words, but this might get you started
/*
ALTER FUNCTION [dbo].[SplitString]
(
@String VARCHAR(8000) ,
@Delimiter VARCHAR(10)
)
RETURNS @RetTable TABLE(
String varchar(1000)
)
AS
BEGIN
DECLARE @i INT ,
@j INT
SELECT @i = 1
WHILE @i <= LEN(@String)
BEGIN
SELECT @j = CHARINDEX(@Delimiter, @String, @i)
IF @j = 0
BEGIN
SELECT @j = LEN(@String) + 1
END
INSERT @RetTable SELECT SUBSTRING(@String, @i, @j - @i)
SELECT @i = @j + LEN(@Delimiter)
END
RETURN
END
*/
DECLARE @SearchString VARCHAR(MAX)
SELECT @SearchString = 'your,of'
DECLARE @SearchStringTable TABLE(
Words VARCHAR(MAX)
)
DECLARE @TABLE TABLE(
Col VARCHAR(MAX)
)
INSERT INTO @TABLE (Col)
SELECT
'On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document.'
INSERT INTO @TABLE (Col)
SELECT
'You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.'
INSERT INTO @TABLE (Col)
SELECT
'When you create pictures, charts, or diagrams, they also coordinate with your current document look.'
INSERT INTO @SearchStringTable (Words) SELECT * FROM dbo.SplitString(@SearchString,',')
SELECT t.Col,
COUNT(1) AS Number
FROM @TABLE t,
@SearchStringTable s
WHERE CHARINDEX(s.Words,t.Col) > 0
GROUP BY t.Col
HAVING COUNT(1) = (SELECT COUNT(1) FROM @SearchStringTable)