stevegray
4Penny.net
Points: 63259

4/22/2026 12:42:20 PM

Parsing @tags from a SQL text field

* This article, and all our great SQL (General) documentation, Is available on the SQL (General) menu
Modern applications rely heavily on user-generated content, and with that comes the need to identify and react to tagged users inside free-form text. SQL Server doesn’t offer a built-in tag parser, but with a bit of pattern logic and defensive coding, we can create one that’s fast, predictable, and easy to maintain. In this article, I’ll break down the function I use to extract tags from comment fields and explain the reasoning behind each step.
4Penny.net
Version: All
Section: SQL Scripts
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3