Sample Input Data
ID HtmlText
-- -------------------------------------------------------------------------
1 <Html><Body><Font>This is challenge #18</Font><Font></Font></Body></Html>
Expected Output
ID TagNamesOccurance
-- -----------------------------------------------------------------
1 Body(Found: 1 time), Font(Found: 2 times), Html(Found: 1 time)
Script
DECLARE @t TABLE(ID INT IDENTITY, HtmlText VARCHAR(Max))
INSERT INTO @t(HtmlText)
SELECT '<Html><Body><Font>This is challenge #18</Font><Font></Font></Body></Html>'
SELECT * FROM @t
Read more: Beyond Relational