August 8, 2011 at 7:59 pm
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 🙂
August 8, 2011 at 8:54 pm
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
August 11, 2011 at 1:37 pm
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
August 11, 2011 at 3:00 pm
Hi Dixie
Thanks for that.
Kind regards
Ross
August 11, 2011 at 3:07 pm
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