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($...
2
votes
1
answer
1k
views
Performance of CLR stored procedures from SQL Server
I have a SQL CLR stored procedure that parses a TLVBER String, this CLR procedure is called each time a command is sent to the DB, there are 6 commands.
The 6 commands represents a single transaction.
...
6
votes
1
answer
946
views
SQL ORDER BY within OVER clause incompatible with CLR aggregation?
Preamble
I have been investigating a concept and what I am posting below is a cut down version of what I have been trying. If you look at it and think "That doesn't make any sense to do it that way" ...
25
votes
4
answers
22k
views
Does or does not SQL Azure support CLR assemblies?
We've got a couple of on-premises dbs and we're seeing if we can migrate them to SQL Azure. Some of those dbs have a couple of user defined functions written in C# in an assembly (SAFE). After running ...
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
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) ...
43
votes
7
answers
66k
views
SQL Server: How to list all CLR functions/procedures/objects for assembly
Question: In SQL Server 2005, how can I list all SQL CLR-functions/procedures that use assembly xy (e.g. MyFirstUdp) ?
For example a function that lists HelloWorld for query parameter MyFirstUdp
...
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....
5
votes
3
answers
17k
views
System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host
I'm using threading in my SQLCLR Project and I'm getting the following error when I try to run my user defined function. What can I do to enable threading things such as the Parallel library and await/...
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 '...\...
0
votes
1
answer
1k
views
Call rabbitmq using SQL Server CLR
I have implemented this article to call rabbitmq inside SQL Server:
[https://nielsberglund.com/2017/02/11/rabbitmq---sql-server/][1]
But when I try to send a message using the CLR I get this error:
...
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 ...
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 ...
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
{
...
2
votes
1
answer
837
views
TSQL logging inside transaction using CLR stored procedure
I'm trying to write a log into another database inside a transaction so that the log will survive even if the transaction is rolled back. I've read this answer which says:
One possibility is to use ...
1
vote
1
answer
284
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....
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 ...
8
votes
4
answers
15k
views
Get the names of attributes from an element in a SQL XML column
For this xml (in a SQL 2005 XML column):
<doc>
<a>1</a>
<b ba="1" bb="2" bc="3" />
<c bd="3"/>
</doc>
I'd like to be ...
13
votes
3
answers
8k
views
The specified option 'clr enabled' is not supported by Azure SQL Edge
I'm a .NET developer and new to mac (m1 pro). I use docker and pull the azure-sql-edge image. When I try to create a table with a geometry column or insert a value in the geometry type column that was ...
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. ...
24
votes
6
answers
24k
views
SQLCLR using the wrong version of the .NET Framework
During a recent restart of our development server the SQL Server started using .NET 4.0 for the SQLCLR. This means that nothing using the CLR in SQL works, or at least that's my understanding by ...
0
votes
1
answer
606
views
Retrieve Table data from SQL DB using an Assembly
Alright so using C# I am creating a DLL that I am using in SSMS and attaching it as an assembly to perform a few tasks, I can create/use the DLL fine but I am having trouble access the DB from the DLL ...
43
votes
7
answers
104k
views
How to grant the database owner (DBO) the EXTERNAL ACCESS ASSEMBLY permission?
When I try to create assembly in SQL 2008 from .Net assembly (.Net 3.5) I am getting the below error, error says that I have to set either of the below properties as true, how can I do that?
The ...
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 ...
4
votes
2
answers
2k
views
SQLCLR - How can I register referenced assemblies of my CLR assembly without setting TRUSTWORTHY ON?
I'm having issue registering referenced assemblies that I used in my SQL CLR assembly. For example I have SQL CLR assembly named Something.dll. This Something.dll references Newtonsoft.dll.
I sign ...