This should work, but I strongly advise against deploying anything like this in production, unless your tables are extremely small. But it's worth posting because it may help you find a proper solution.
SPLIT_STRING
returns a one-column table (the column name is [value]
), which contains the list of words (see https://learn.microsoft.com/en-us/sql/t-sql/functions/string-split-transact-sql?view=sql-server-ver15). This column is joined with the first table using LIKE (see the CROSS APPLY block).
-- Declare test tables
DECLARE @TABLE1 table([TEXT] varchar(1000))
DECLARE @TABLE2 table([TEXT] varchar(1000))
-- Populate tables
INSERT INTO @TABLE1
VALUES ('alpha bravo charlie'), ('delta echo lima'), ('golf hotel india'), ('tango uniform victor')
INSERT INTO @TABLE2
VALUES ('alpha lima'), ('tango')
-- Query
SELECT DISTINCT T1.[TEXT]
FROM @TABLE1 T1
INNER JOIN @TABLE2 T2 ON 1 = 1
CROSS APPLY (SELECT * FROM STRING_SPLIT([T2].[TEXT], ' ') T3 WHERE T1.[TEXT] LIKE '%' + T3.value + '%') AS T3