1,020 questions
-1
votes
1
answer
61
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 ...
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 ...
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 ...
0
votes
1
answer
198
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 ...
2
votes
0
answers
392
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 ...
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 ...
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
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 ...
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 ...
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
4
answers
191
views
Using C# CLR in SELECT and WHERE at the same time
I have a C# CLR doing multiple string manipulations. It returns an int. I'm calling it with
SELECT func(col1, col2) AS Score
INTO #A
FROM table;
SELECT *
INTO #B
FROM #A
WHERE Score > -1
If I do ...
0
votes
0
answers
356
views
External Stored procedure blocks when called from trigger
I have a stored procedure calling an external function:
ALTER PROCEDURE [dbo].[spFoo_CallApp]
@Url [nvarchar](max),
@Payload [int],
@Type [nvarchar](max)
WITH EXECUTE AS CALLER
AS
EXTERNAL ...
1
vote
1
answer
2k
views
SQL Server 2017: Failed To Create Assembly. Check if referenced assemblies are up-to-date and trusted
I found this same issue in my research, but no solution was found: Research Link
This .dll is System.net.http, and it is pulled from the 4.6.1 .NET Framework. I am trying to create an assembly out of ...
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 ...
-1
votes
1
answer
115
views
sql server, replace chars in string with values in table
how can i replace values in string with values that are in a table?
for example
select *
into #t
from
(
select 'bla'c1,'' c2 union all
select 'table'c1,'TABLE' c2 union all
select '...
1
vote
1
answer
473
views
Trustworthy is ON with UNSAFE assemblies not running
I am just testing something internal and now the TRUSTWORTHY is set to ON security risks.
I am wondering though, if TRUSTWORTHY is ON, can an UNSAFE assembly stop working if it is signed and and has ...
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 ...
0
votes
1
answer
195
views
How to add SQLCLR to AWS with certificate?
I have created a SQLCLR functions works with RabbitMQ.
Added them to SQL Server as described here
https://nielsberglund.com/2017/07/01/sqlclr-and-certificates/
using certificate: created it, added to ...
2
votes
1
answer
2k
views
How to script and load assemblies list to SQL Server?
My SQL CLR procedure depends on log4net, it depends on System.Web.dll.
When I upload this System.Web.dll :
create assembly [System.Web]
from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Web....
1
vote
0
answers
368
views
Is it possible to to add .NET Framework 5.0 and .net core 3.1 Assembly to SQL Server 2019?
Error in Adding CLR assembly of .net framework 5.0 in SQL Server 2019.
I have a DLL which uses .NET Framework v5.0. and I want to add it to SQL Server 2019 using CREATE ASSEMBLY.
Is it possible to to ...
0
votes
1
answer
393
views
Deploying SQLCLR in Visual Studio -- How to override the generated publish script
Microsoft SQL Server 2019 15.0.2000.5
Microsoft Visual Studio Community 2019 Version 16.11.2
Microsoft .NET Framework Version 4.8.04084
SQL Server Data Tools 16.0.62107.28140
When publishing C# ...
0
votes
0
answers
69
views
How to write logs in SQCLR procedure to Elastic?
Is it possible to write logs in SQLCLR procedure to ElasticSearch (EFK or ELK stacks)?
If it is where are any examples?
2
votes
1
answer
963
views
SQL Server database project in VS. Order of sql script generation step in build process
I have a SQL Server database project in my solution and several dependencies projects.
When I compiling (in VS) this database project I've get a SQL script and a .dacpac file as result.
But also I ...