简体   繁体   中英

How to count words in T-SQL excluding HTML tags

Given a table where one column contains HTML, how can I get a word count for each row, excluding HTML tags? Basically I want to count how many words will ultimately be rendered in the browser.

Using SQL Server 2008 R2.

You could adapt this SQL function to parse delimited strings to split the string be spaces, and count words that way. It will be approximate, but if you need a more accurate count it will be easier using .net, parsing the page and getting the word counts from within the html nodes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM