When is it an advantage using CLR?

  • Hi folks

    I was wondering about CLR (or SQLCLR) lately.

    As I understand it, T-SQL has been around for a long long time...., but CLR is a fairly new thing.

    What I am wondering is, are there any advantages in using CLR?

    What sort of usage scenarios?

    Kind regards

    Ross 🙂

  • Well-written CLR has proven to have some clear performance advantages over T-SQL in performing complicated string manipulation, such as parsing of large text strings. Solutions that require array structures or procedural logic would also be probable candidates for CLR.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • CLR can bring a brevity to your code not offered by T-SQL and in some cases can exceed the performance offered by native T-SQL.

    Here is one example for a string-concatenation aggregate that makes code far more readable (IMHO) while performing slightly better than native T-SQL methods:

    http://groupconcat.codeplex.com

    Here is another example for a CLR string splitter that outperforms native T-SQL:

    Tally OH! An Improved SQL 8K “CSV Splitter” Function[/url] Note: the source for the CLR splitter function is not provided, but you can compile it from it's serialized form using the build script "Build all objects and run all tests.zip" linked to at the end of the article.

    I am sure there are many other examples.

    Whether it is best to employ SQLCLR will depend on a lot of things. In my experience however the biggest barrier for adoption by far is that .NET is not a core competency of the vast majority of database developers or DBAs.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Hi Dixie

    Thanks for that.

    Kind regards

    Ross

  • Hi opc.three

    That article Tally OH! is very interesting.

    Thanks for that.

    Kind regards

    Ross

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply