1,020 questions
-1 votes
1 answer
71 views
Publish VS project fails on System.Net.Http 4.2.0.0 not found in SQL Server even though other projects use it
I have several Visual Studio projects (Stored Procedures) that have been published to SQL Server 2014 (yes old I know - legacy software) that use System.Net.Http v4.2.0.0 so I know that the assembly ...
0 votes
1 answer
151 views
SQL CLR function bad performance comparing to .NET App
In our system we are hashing passwords with the following method. public static string HashPassword(string password, byte[] salt) { if (salt == null) { throw new ArgumentNullException($...
3 votes
1 answer
265 views
How to detect query cancellation signal inside a SQLCLR function
I have a CLR scalar function that does some calculations, these can take a long time. When the user cancels the execution of the query, it doesn't seem like the function execution is affected, so the ...
0 votes
0 answers
59 views
How to access the Exception that caused a SQLCLR Exception
I have a SQLCLR scalar function that uses the context connection to read data. Sometimes, the SQL statement being run by the CLR deadlocks. The scalar function itself is being run in a standard stored ...
2 votes
1 answer
216 views
Resolving Poor Execution Plan in SQL Server with CLR Scalar Function
Essentially, my question boils down to observing these two query plans (from SQL Server 2019): Plan using a SQL-defined scalar function. Link to plan Plan using a CLR-defined scalar function. Link ...
1 vote
1 answer
107 views
Generate a XLS file using SQL CLR That does not have loads of incompatible Dependencies
I want to do something simple, Create a SQL CLR that converts data to XLS. I've tried Using OpenXML, but it keeps installing windowbase as a dependency, which uses system.XAML, which SQL server (2019) ...
0 votes
1 answer
199 views
CLR function for counting combining characters in SQL Server
The following C# method counts string characters considering combining characters (Grapheme Clusters). Here it is: public static class StringExtensions { public static SqlInt32 GetStrLength(this ...
0 votes
0 answers
81 views
Send an email from SQL Server using CLR Assembly (microsoft modern authentication)
I have created a class library project to send an email using Azure.Identity, Microsoft.Graph. after that, I complied into DLL when I tried to create Assembly in SQL Server it threw error Assembly '...
2 votes
0 answers
394 views
Computing SHA256 in a SAFE CLR assembly
We have build a .NET function that (among other things) need to compute a SHA256 hash. For this, we have called the System.Security.Cryptography.SHA256 class from .NET Framework. After adding the CLR ...
1 vote
1 answer
248 views
SQL Server cannot create assembly as it references system.runtime, version=5.0.0.0
I'm trying to create my first CLR assembly. I have created a dll in VS and now I am trying to use it in SQL Server. I try to create assembly with this code: CREATE ASSEMBLY SQLCLRroy FROM '...\...
2 votes
1 answer
104 views
How to check how many times CLR function was called from stored procedure without changing procedure's code?
I have a stored procedure with some CLR functions inside it. I need to check how many times these functions are being called during one stored procedure execution. I have found this select at ...
0 votes
0 answers
93 views
Assembly Cannot be installed because of Existing Policy CLR [duplicate]
I have written a CLR Assembly that I wish to deploy to SQL Server 2017 (14.0.3048.4). The assembly uses C# and Targets .NET Framework 4.8, which is installed on the server (Release 528049, Version 4.8....
1 vote
2 answers
2k views
How to create an asymmetric key in SQL Server
I am trying to create an UNSAFE assembly in SQL Server without having to alter any global database or server permissions such as EXEC sp_configure 'clr strict security', 0 or ALTER DATABASE MyDatabase ...
0 votes
0 answers
122 views
Loopback connection using CLR with same user credentials, outside current transaction
I want to create new connection in a clr assembly having same access as the current user (ie loopback using the current user credential) The new connection must be outside the current transaction and ...
1 vote
1 answer
290 views
Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0,' failed. in SQLCLR UDF in SQL Server on Linux 2019
I have created a SQLCLR UDF and am deploying it (using SSDT) to SQL Server 2019 on Linux. When I try to execute the function it returns the following error: Request for the permission of type 'System....