2 responses

  1. Solomon Rutzky
    2019-02-06

    Hi Wayne. Please don’t use the “Trusted Assemblies” feature. It is an entirely inferior and unnecessary “feature” that only exists because Microsoft needed something to provide some level of security for the few remaining assemblies that were allowed to exist once they pulled SQLCLR support from Azure SQL Database back in April of 2016. And it only exists in non-Azure SQL Server because existing DBs with unsigned assemblies that were either upgraded to 2017 or restored into 2017 were getting the “not trusted” error, and nobody at Microsoft knew that assemblies that were already loaded into SQL Server could be signed without needing to export, sign, and re-import. It was merely a knowledge oversight, and they had the “trusted assemblies” code that had been added for Azure so they un-hid it. It is something that never should have existed, and does a poor job of solving a problem that was solved back in SQL Server 2005. I cover all of this here:

    //sqlquantumleap.wordpress.com/2017/08/07/sqlclr-vs-sql-server-2017-part-1-clr-strict-security/

    Creating a certificate is really not that hard, and shouldn’t be discouraged since it is the optimal method of providing security for assemblies. And this hasn’t changed since SQLCLR was introduced in SQL Server 2005. In fact, Part 4 of my “SQLCLR vs SQL Server 2017” series is about signing existing unsigned assemblies, and it has example code showing how to do it.

    Also, with regards to splitting strings:

    a) this is built into SQL Server 2016 and newer via STRING_SPLIT, but that doesn’t return a Row / Element ID, so that is not usable for some folks / scenarios,

    b) the SQLCLR library that I created, SQL# ( //SQLsharp.com/ ), comes with a few string splitters. Starting in version 4.0, I added String_SplitInts which is for splitting a list of BIGINT / INT / SMALLINT / TINYINT values. It does the conversion to BIGINT in the .NET code so you get a result set of BIGINT back instead of strings. This is very fast for both CPU and elapsed times. It even includes an option for returning a single row of NULL if the input is NULL (some folks seem to like that). And when the input is known to never be over 4k characters, the “4k” version is even faster. I am mentioning SQL# because this is in the Free version, and the security is handled properly (using signatures) so no extra effort needs to be done to get it installed. It just works :).

    Take care, Solomon..

    Reply

Leave a Reply to let me know how you liked this post

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top
mobile desktop