1,020 questions
2
votes
1
answer
378
views
DES Decryption in SQL CLR Scalar UDF not working
We have a legacy application that uses SQL Server as its back-end. As part of some security concerns, it encrypts some fields collected from the user using (single) DES with a key & IV that is ...
-3
votes
3
answers
181
views
Convert VB CLR function to C#
How can I convert below VB.net SQL CLR function to C# CLR Function for a VS SSDT SQL Project?
I need to convert it to C# as it seems that built-in SSDT Project support for CLR functions is C# only? If ...
2
votes
2
answers
379
views
SQL Assembly WebResponse and String Parsing VERY slow
So I am quickly learning the ways of C# (complete noob that inherited this problem); I have written up the following code which calls a web service that returns JSON that is not always well-formed. ...
17
votes
2
answers
2k
views
Why is HashSet<T> attributed with MayLeakOnAbort, but Dictionary<K,V> not?
I noticed when trying to code a CLR procedure for SQL Server that HashSet is not allowed due to being attributed with [HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort = true)]. SQL ...
1
vote
0
answers
738
views
Error when requesting HTTPS from SQLCLR Stored Procedure
I created a SQL CLR stored procedure that is triggered when an INSERT happens in the database. The stored procedure then uses HttpWebRequest to make an API JSON POST.
The problem is that API uses SSL ...
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
93
views
SQL CLR Function Using Quartz.net
Am trying to create a CLR function and inside am using below quartz.net code snippet
public static class SqlCron
{
[SqlFunction(IsDeterministic = true, IsPrecise = true)]
public static ...
0
votes
1
answer
717
views
How to recover Service Broker after restoring database?
After db restoring on other server the Service Broker is stopped.
The restored db has a Trustworthy Off and now I set it to On to run Broker again.
I understand that it is bad practice. Especially ...
3
votes
2
answers
623
views
Unable to debug .NET after VS 2019 upgrade
I was using the VS 2019 to debug a SQL Server CLR C# .NET code. I got an upgrade notification from VS which I did and rebooted. I now get the error when trying to debug
Unable to debug .NET code. ...
1
vote
2
answers
508
views
Reverse Engineer SQLCLR assembly in SQL Server
I've come across an undocumented Production server with the Assemblies listed below. Any ideas how to reverse engineer the DBFunctions assembly or reproduce it on another SQL Server instance?
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?
0
votes
0
answers
231
views
SQL CLR triggers with Azure Event Hub
Is there any way to implement change data capture on SQL to Azure EventHub without using exe?
The code needs to run in the context of SQL Server only
SQL Server Version : 2014
Tried SQL CLR with Azure ...
0
votes
2
answers
5k
views
SQL Server 2017 Management Studio: CREATE ASSEMBLY error
I created user defined type in C#.
When I run this:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
GO
EXEC sp_configure 'show advanced option', '1';
RECONFIGURE;
GO
USE ...
5
votes
2
answers
838
views
SQL CLR function based on .net ComputeHash is not working with Cyrrilic
I have written the following SQL CLR function in order to hash string values larger then 8000 bytes (the limit of input value of the T-SQL built-it HASHBYTES function):
[SqlFunction(DataAccess = ...
0
votes
1
answer
608
views
Assembly 'System.Threading.Channels' references assembly 'system.threading.tasks.extensions, v.', which is not present in the current database
I am trying to add a DLL into SQL Server:
CREATE ASSEMBLY ClassLibrary1
AUTHORIZATION dbo
FROM 'C:\Debug\ClassLibrary1.dll'
WITH PERMISSION_SET = UNSAFE
GO
As you can see here my DLLs
But I get this ...
1
vote
0
answers
244
views
Using StringBuilder as a SQL CLR UDF in SQL Server statement
SQL Server is missing a StringBuilder UDF(s), how do I to overcome this limitation?
This is what I built to overcome the problem:
You can use this in a SQL statement, notice that you need to SET the ...
0
votes
1
answer
130
views
Can a SQL Server Feature Pack of a certain version (2012, 2016, etc.) be used with a lower version of SQL Server?
My company is in the process of upgrading the SQL Server CLR types that are being used with our software. After Googling around, I couldn't find a definitive yes/no answer to whether or not the SQL ...
1
vote
1
answer
3k
views
Cannot drop asymmetric key because there is a login mapped to it
I created an asymmetric key 'key_clr_http_request' and if I select * from sys.asymmetric_keys I can see it:
I now would like to delete it:
use master
DROP ASYMMETRIC KEY key_clr_http_request
But as ...
1
vote
2
answers
212
views
SQL Server 2012 assembly execution failure - System.NullReferenceException: Object reference not set to an instance of an object
I am trying to execute a UDF which uses a CLR assembly. Each time I try to run it I get the below error:
Msg 6522, Level 16, State 1, Line 45
A .NET Framework error occurred during execution of user-...
0
votes
2
answers
889
views
SQL CLR issue: CREATE PROCEDURE failed because parameter counts do not match
I did check this but the problem doesn't appears to be with mismatch of type.
I'm trying to use CLR to convert back a file from blob data. Below is the c# code converted to dll and stored using ...
1
vote
1
answer
1k
views
How to get a result from CLR stored procedure
I have a CLR stored procedure in c# that goes something like
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void DecimalToWords (decimal sum)
...
2
votes
1
answer
2k
views
How to enable TLS 1.2 support in SQLCLR 2?
I need to force the usage of TLS 1.2 in SQLCLR assembly which is installed on SQL Server 2008 R2.
I have read the answer explaining how to enable TLS 1.2 programatically.
Unfortunately, adding System....
0
votes
0
answers
219
views
SqlDataReader (in an assembly) returning different datatypes compared to sp_help
I have a custom assembly that returns the column information for whatever query is thrown at it. While I was going through & double checking the values, it appears that a few of the 'DataTypeName' ...
2
votes
1
answer
1k
views
How to add a web service reference or connected service in a VS2019 C# SQL CLR?
I am writing a C# SQL CLR project (or "SQL Server Database Project", as it is apparently called now) in Visual Studio 2019 and I need to call a web service from it.
In VS 2017 and earlier it was ...
0
votes
2
answers
1k
views
SQLCLR custom aggregate with multiple parameters
I have trouble understanding of how CLR User-Defined Aggregates work.
I have to create some custom CLR aggregates with multiple parameters.
The point is to get the value of the first parameter ...