1,020 questions
2
votes
1
answer
1k
views
Visual Studio 2019 Missing SQL CLR VB
In VS2019 under "Project | Add New Item | Installed | SQL Server" I have the "SLQ CLR C#" option but not the "SQL CLR VB" option. How do I get the VB option?
The SQL ...
0
votes
0
answers
125
views
Invoke an AWS Lambda function asynchronously from an EC2 SQL Server
Is it possible to somehow invoke an AWS Lambda function from an EC2 hosted SQL Server 2019 instance? Could this be achieved using SQL Server CLR Functions perhaps? Before I attempt it I wondered if ...
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 ...
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 ...
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 ...
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 ...
1
vote
1
answer
914
views
How to deploy certificate and signed assembly to other database?
I have created a certificate, signed my assembly (UNSAFE) and it works, All as described there
https://nielsberglund.com/2017/07/01/sqlclr-and-certificates/
Now I need to deploy the solution to many ...
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....
0
votes
1
answer
86
views
Access data across function calls in same connection
I need help solving a performance problem related to a recursive function in SQL Server. I have a table of tasks for items, each of which have a lead time. My function recursively calls itself to ...
2
votes
1
answer
637
views
Visual Studio 2019 SSDT project SQLCLR signing not generating signed DLL
I used Visual Studio 2019 to create a SSDT project. Added a SQL CLR C# user defined function.
Open project properties page, in the SQLCLR tab, click Signing... button to check the "Sign the ...
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:
...
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 ...
0
votes
1
answer
540
views
Cannot Publish SQL Server Database Project because of .NET compatibility issues
I am in a situation where I cannot find a workaround.
I am trying to develop an SQL CLR project on Visual Studio 2015 where you can do POST and GET HTTP requests from SQL server. I was able to ...
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-...
1
vote
1
answer
2k
views
Upload a file to AWS S3 using C# without using AWS SDK
I need to create a C# SQL CLR stored procedure to upload files (data exports) to AWS S3 buckets. These files will generally be very small.
The AWS SDK cannot be installed on the SQL Servers and I am ...
2
votes
2
answers
602
views
Set decimal precision in SQL CLR function in C#
I have a SQL CLR function written in C# that goes something like:
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString Decimal(decimal ...
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' ...
1
vote
1
answer
317
views
SQLCLR Assembly Much Faster When Unloaded
I have a SQLCLR assembly that does a simple JSON deserialization using the LitJson package on a SQL Azure Managed Instance. This CLR is called from a table-valued function that just returns the JSON ...
-1
votes
1
answer
735
views
Use Cryptography.RSACryptoServiceProvider assembly in SQL Server 2017 for decryption
In my asp.net MVC project, i created functions to encrypt/decryt via RSA which works fine as expected. I stored public/private keys on azure vault and accessing on runtime which is also fine.
I am ...
2
votes
1
answer
5k
views
How does one Register a C# CLR Assembly with SQL Server without using Security Hacks?
When I try and register a signed C# assembly in SQL Server via the Object Explorer in SSMS by right-clicking on the "Assemblies" node and selecting "New Assembly", then my signed DLL via "Browse", I ...
3
votes
2
answers
977
views
Is it possible to have a CLR function in SQL take on a specific windows identity?
I want to have a CLR function run as a specific windows identity when called from SQL Server Agent Jobs. To that end, the SQL statement calling the function has the form:
execute as user='domain\...
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 ...