1,020 questions
0
votes
1
answer
127
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
253
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 ...
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
0
answers
57
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 ...
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 ...
1
vote
1
answer
241
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 '...\...
26
votes
1
answer
50k
views
How to disable "clr strict security" in SQL Server
I enabled clr integration (i.e. SQLCLR) by running:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
Now when I try:
EXEC sp_configure 'clr strict security', 0;
RECONFIGURE;
I get an error ...
0
votes
0
answers
75
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 '...
72
votes
4
answers
90k
views
Difference between scalar, table-valued, and aggregate functions in SQL server?
What is the difference between scalar-valued, table-valued, and aggregate functions in SQL server? And does calling them from a query need a different method, or do we call them in the same way?
26
votes
3
answers
28k
views
CLR Strict Security on SQL Server 2017
MSDN on this article says:
CLR uses Code Access Security (CAS) in the .NET Framework, which is no
longer supported as a security boundary. A CLR assembly created with
PERMISSION_SET = SAFE may ...
48
votes
2
answers
25k
views
SQL Server: Could not find type in the assembly
Assume the assembly dll:
using Microsoft.SqlServer.Server;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System;
using System.Text;
namespace CLRFunctions
{
public class T
{
...
1
vote
1
answer
243
views
CLR Table Valued Function Parameter Count for FillRow method error
I have a C# (.NET Framework 4.7.2) script to perform some custom reading of trace codes, which I am trying to use to make a SQL (V14.0.3445.2) Table Valued Function. The C# FillRow Method looks like ...
1
vote
1
answer
1k
views
How to sign DLL with certificate in Visual Studio (SQL Server CLR)
I try to sign the CLR assembly in Visual Studio database project (SSDT) so that I can publish the assembly into the SQL Server but with no success.
What I have done manually and it works
Created ...
0
votes
0
answers
121
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
358
views
How can I stop SQL CLR projects from generating DROP DATABASE in their deployment scripts?
How can I stop SQL CLR projects from generating DROP DATABASE in some deployment scripts?
I have been using SQL Server SQL CLR for 10+ years for scalar functions, aggregates and User-Defined Types. ...
4
votes
3
answers
11k
views
What is the purpose and risks of enabling SQL CLR?
We are looking to implement unit tests using the tSQLt test framework. It has got a pre-requisite that the SQL CLR must be enabled using this command:
EXEC sp_configure 'clr enabled', 1; RECONFIGURE;
...
0
votes
2
answers
2k
views
CLR function migration how to extract code from assembly
I need to migrate instance of SQL Server and found that I don't have a source code for a few CLR functions anywhere, I see functions in assembly and know their logic:
select * from sys....
1
vote
1
answer
5k
views
A SQL CLR Assembly set to UNSAFE with a key is no longer working
I have had an UNSAFE assembly running on an internal only database and web application but the IT dept. might have changed something as we noticed it just stopped working and trying to figure out why.
...
0
votes
3
answers
978
views
Issue loading clr assembly into sql server that uses system.text.json
Have a clr assembly that references System.Text.Json (.net 4.8 with SQL Server 14), when I try to load it into SQL Server (CREATE ASSEMBLY) I get:
Assembly 'my assembly' references assembly 'system....
7
votes
3
answers
6k
views
SQLCLR Support on AWS SQL Server 2017 RDS
I need to load an Assembly in AWS SQL Server 2017 RDS.
I am not able to find it in the documentation. Is this possible? If yes, then how?
This is similar to, but not a duplicate of, "SQL Server CLR ...
0
votes
0
answers
143
views
Alter Assembly not altering an assembly
Recently we have noticed that ALTER ASSEMBLY is not updating the dll on the SQL Server. We have been altering the assembly since last two years and never had an issue before. The major change we have ...
0
votes
0
answers
162
views
SQL CLR streams data and is unsafe I need a safe solution
I have a SQL server C# CLR function that streams results. because of that I open a new connection inside the CLR and because of that I need to create the CLR unsafe. Now I want to move to sql ...
14
votes
1
answer
5k
views
.Net Core assemblies in SQL CLR
Can .Net Core 3 assemblies be used in SQL CLR? And if not so, what will happen with the arrival of .Net 5? Or is it only possible to use only .Net Standard 2 and implement it as >net Framework?
5
votes
2
answers
5k
views
SQL 71501 has an unresolved assembly reference
We are using SSDT tools with Visual Studio 2015 and Target Platform set to SQL Server 2008. We are stuck with this function which is throwing an error and need assistance on what we can do to fix it.
...
0
votes
1
answer
489
views
SQL Server language extension performance
A SQL Server Language Extension function is executed in an external process. Does it mean that when such a function is called in a Select clause it creates a new process for every row in the recordset ...