Home Forums SQL Server 2012 SQL 2012 - General SQL help - how do we find that a particular string appears x times in a certain field RE: SQL help - how do we find that a particular string appears x times in a certain field

  • Matt Miller (#4) (8/25/2016)


    I'm sorry if I am taking the fun out of building a SQL only solution, but there are lots of basic samples of SQLCLR showing how to expose the Regex.Matches() method from .NET CLR.

    A good evrsion is located here courtesy of Phil Factor:

    https://www.simple-talk.com/sql/t-sql-programming/clr-assembly-regex-functions-for-sql-server-by-example/[/url]

    NO, NO, NO!

    Use NGrams8K[/url]. It will perform better than any CLR or regex solution Ive ever seen and you dont need to install anything, learn any new programming languages, change any SQL Server settings or add any new assemblies.

    I'm on a train without SQL Server access at the moment but I'll post something later tonight unless someone beats me to it.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001