DECLARE @names NVARCHAR(MAX) = 'ruby,rails,scruffy,rubyon...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @names NVARCHAR(MAX) = 'ruby,rails,scruffy,rubyonrails,sql';

SELECT t.*
FROM Tags t
JOIN STRING_SPLIT(@names,',')
  ON t.TagName = [value]
ORDER BY Count DESC;


--
CREATE TABLE #t(val NVARCHAR(120));
INSERT INTO #t(val)SELECT s.[value] FROM STRING_SPLIT(@names, ',') s;

SELECT *
FROM Tags tg
JOIN #t t
  ON t.val = tg.TagName COLLATE SQL_Latin1_General_CP1_CI_AS
ORDER BY Count DESC;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results