Questions tagged [sql-clr]

SQL CLR is Microsoft's Common-Language-Runtime implementation for SQL Server. Use this tag for questions about how to implement and troubleshoot SQLCLR on Microsoft SQL Server.

SQL CLR provides a method for extending the capabilities of SQL Server via the Microsoft.Net platform and the common-language-runtime.

SQL CLR allows you to use C# to create natively compiled, highly customized code patterns that may not be supported or easily implementable directly through T-SQL, such as user-defined aggregates and user-defined types.

137 questions
31
votes
4 answers

What is a scalable way to simulate HASHBYTES using a SQL CLR scalar function?

As part of our ETL process, we compare rows from staging against the reporting database to figure out if any of the columns have actually changed since the data was last loaded. The comparison is based on the unique key of the table and some kind of…
Joe Obbish
  • 32,976
  • 4
  • 74
  • 153
18
votes
3 answers

Setting up a central CLR stored procedure / function respository library for internal stored procs in other databases to use?

I would like to use code that I developed in C# CLR to be used in all of the databases on the system so that I don't have to set each to trustworthy and turn CLR on and keep a bunch of the same code inside each one. Is there a best way to do this…
Alex Erwin
  • 653
  • 2
  • 5
  • 12
15
votes
3 answers

3rd party dll in SQL Server CLR

I need to use a third party DLL in a trigger c# code in SQL Server CLR But when I try to add reference it just shows some DLLs from SQL Server. How can I add my third party dll to SQL Server?
AVEbrahimi
13
votes
2 answers

Storing IP addresses - varchar(45) vs varbinary(16)

I am going to create a table with two fields - ID as BIGINT and IPAddress as either varchar(45) or varbinary(16). The idea is to store all unique IP addresses and use a reference ID instead the actual IP address in other tables. Generally, I am…
13
votes
2 answers

Do SQL Server Express Editions support CLR procedures?

Do SQL Server Express Editions (2005, and 2008) have support for installing, enabling and running CLR Stored procedures and functions.
12
votes
2 answers

Crashing CLR on SQL Server 2014 (windows 2012R2)

I have this small CLR that does a RegEX function on a string in columns. When running on SQL Server 2014 (12.0.2000) on Windows Server 2012R2 the process crashes with Msg 0, Level 11, State 0, Line 0 A severe error occurred on the current…
Spörri
  • 4,734
  • 15
  • 28
11
votes
2 answers

Security or performance risks using SQL CLR

Are there any particular security or performance risks in using the CLR in SQL Server ?
SQLBen
  • 355
  • 1
  • 5
  • 18
11
votes
2 answers

Other than restarting SQL Server, is there any way to force the SQLCLR AppDomain to be reset?

I want to force the AppDomain being used by SQLCLR to be reset. How can I do that besides restarting the SQL Server instance?
Justin Dearing
  • 2,717
  • 6
  • 36
  • 52
10
votes
1 answer

What is the SQLCLR wait type in Activity Monitor within SQL Server Management Studio (SSMS)?

When I check our SQL Prod server, every time I open Activity Monitor I always see SQLCLR on the first list on the resource wait section in the Activity Monitor. It always has a high number. What is SQLCLR for? Is it bad for the server having that…
Keith Rivera
  • 617
  • 2
  • 9
  • 20
9
votes
3 answers

Assembly 'system.web, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.' was not found in the SQL catalog

I am trying to deploy a SQL CLR function using the HTTPUtility.UrlDecode method of System.Web but I can't get it to deploy. Error received: .Net SqlClient Data Provider: Msg 6503, Level 16, State 12, Line 1 Assembly 'system.web, version=4.0.0.0,…
wBob
  • 10,420
  • 2
  • 25
  • 44
9
votes
1 answer

Reference assembly in sqlproj not being deployed to server

I have a Visual Studio 2013 Database Project which takes a modified version of fastJSON as a reference. I selected Generate DDL in the reference properties as shown in this screenshot: And in the .sqlproj msbuild file:
Justin Dearing
  • 2,717
  • 6
  • 36
  • 52
9
votes
3 answers

Azure SQL Database CLR functions are working

I'm in the middle of migrating a database to Azure SQL Database. I was reading about the differences between Azure SQL Database and Azure Managed Instance and noticed that CLR functions are NOT supported in Azure SQL Database. This surprised me as…
paulH
  • 1,642
  • 1
  • 21
  • 40
9
votes
1 answer

Apparently, my CLR assembly function is causing deadlocks?

Our application needs to work equally well with an Oracle database or a Microsoft SQL Server database. To facilitate this, we created a handful of UDFs to homogenize our query syntax. For example, SQL Server has GETDATE() and Oracle has SYSDATE.…
Russ Suter
  • 91
  • 1
9
votes
3 answers

Is the hierarchyid CLR open-source?

The built-in hierarchyid is a CLR that stores paths in an efficient binary form, and provides other useful functionality. Unfortunately, there is limit to how deep the represented paths can be, and it's ~1427 for a binary tree. I would like to…
9
votes
1 answer

dm_exec_describe_first_result_set_for_object for multiple result sets

Does a procedure exist to return metadata for all result sets in a stored procedure? Something like sys.dm_exec_describe_first_result_set_for_object, but for all result sets? Eventually, I will want to discover the metadata for every result set in…
JJS
  • 721
  • 1
  • 5
  • 17
1
2 3
9 10