Questions tagged [sqlclr]

SQLCLR (SQL Common Language Runtime) is technology for hosting of the Microsoft .NET common language runtime engine within SQL Server. The SQLCLR allows managed code to be hosted by, and run in, the Microsoft SQL Server environment.

SQL CLR or SQLCLR (SQL Common Language Runtime) is technology for hosting of the Microsoft .NET common language runtime engine within SQL Server. The SQLCLR allows managed code to be hosted by, and run in, the Microsoft SQL Server environment. This technology, introduced in Microsoft SQL Server 2005, allow users for example to create the following types of managed code objects in SQL Server in .NET languages such as C# or VB.NET.

  • Stored procedures (SPs) which are analogous to procedures or void functions in procedural languages like VB or C,
  • triggers which are stored procedures that fire in response to Data Manipulation Language (DML) or Data Definition Language (DDL) events,
  • User-defined functions (UDFs) which are analogous to functions in procedural languages,
  • User-defined aggregates (UDAs) which allow developers to create custom aggregates that act on sets of data instead of one row at a time,
  • User-defined types (UDTs) that allow users to create simple or complex data types which can be serialized and deserialized within the database.

The SQL CLR relies on the creation, deployment, and registration of .NET assemblies, which are physically stored in managed code dynamic load libraries (DLLs). These assemblies may contain .NET namespaces, classes, functions and properties.

Source: http://en.wikipedia.org/wiki/SQL_CLR

1004 questions
22
votes
4 answers

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 a search, I've found a couple of posts which…
20
votes
3 answers

Create CLR stored procedure using the dll created by .net framework 4.0 in sql server 2008. Is shows error

I am using the below code for CLR stored procedure creation. While I am creating the assembly. it shows the below issue. My target framework is 4.0. sql server is 2008 r2 SQL code: create assembly SampleSearch from 'E:\CLR…
Kirupananthan.G.S
  • 265
  • 1
  • 3
  • 9
19
votes
1 answer

Problems Registering Oracle.DataAccess as SQLCLR assembly in MS SQL Server 2012

EDIT 3.5 (Meant to put Item 3 below in the last update, but overlooked. Alas...) Looking at how the assembly registration fails for my problem and looking at what limited info I am able to infer from ProcExplorer traces leads me to make some…
David W
  • 10,062
  • 34
  • 60
19
votes
5 answers

How to notify a windows service(c#) of a DB Table Change(sql 2005)?

I have a table with a heavy load(many inserts/updates/deletes) in a SQL2005 database. I'd like to do some post processing for all these changes in as close to real time as possible(asynchronously so as not to lock the table in any way). I've looked…
Mike Tours
  • 772
  • 2
  • 6
  • 13
17
votes
4 answers

Unable to create the tSQLtCLR assembly in SQL Server 2017

I recently installed SQL Server 2017 Express and localdb (general availablity). While attempting to install the tSQLt framework I've discovered a new security feature implemented in SQL Server 2017: the "clr strict security" option. This new…
Brent
  • 173
  • 1
  • 1
  • 5
17
votes
1 answer

Which version of .NET framework SQL Server supports?

I want to create SQLCLR based stored procedures for SQL Server. As you know I can build a dll against multiple versions of .NET framework. I can't find a reference that describe which version of SQL Server supports which version of .NET framework.…
Just a learner
  • 26,690
  • 50
  • 155
  • 234
17
votes
2 answers

Why is HashSet attributed with MayLeakOnAbort, but Dictionary 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 Server CLR procedures do not allow the use of…
BlueMonkMN
  • 25,079
  • 9
  • 80
  • 146
16
votes
12 answers

Are CLR stored procedures preferred over TSQL stored procedures in SQL 2005+?

My current view is no, prefer Transact SQL stored procedures because they are a lighter weight and (possibly) higher performing option, while CLR procedures allow developers to get up to all sorts of mischief. However recently I have needed to debug…
Ash
  • 60,973
  • 31
  • 151
  • 169
16
votes
2 answers

CLR SQL Assembly: Get the Bytestream?

I have a SQL CLR dll I want to deploy, but have found you can embed the byte stream/varbinary_literal/ varbinary_expression/assembly bits into a text file to get around the messy hassle of packaging a DLL and making sure it's accessible for the…
OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
16
votes
6 answers

What are good problems to solve using CLR stored procs?

I have used CLR stores procedures in SQL server for awhile now, but I'm still wondering what the best situations to use them are. MSDN provides some guidelines for use like heavy string manipulation (regex), or replacing T-SQL that declares lots of…
Tj Kellie
  • 6,336
  • 2
  • 31
  • 40
15
votes
5 answers

Multithreaded caching in SQL CLR

Are there any multithreaded caching mechanisms that will work in a SQL CLR function without requiring the assembly to be registered as "unsafe"? As also described in this post, simply using a lock statement will throw an exception on a safe…
Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
15
votes
3 answers

SSRS 2012 Custom Code .NET Framework 4.0 not supported

I was very hopeful that since SQL Server 2012 SQLCLR supports .NET 4.0 that SQL Server Reporting Services (SSRS) 2012 would support .NET 4.0 custom code assemblies. When attempting to upload an rdl (via the Report Manager or via RSBuild) that…
Adam Caviness
  • 3,424
  • 33
  • 37
14
votes
2 answers

Sql Server CLR load assembly failed

I am trying to deploy an CLR TVF (table value function). In the code I am using JavaScriptSerializer to parse some JSON string, so I reference the System.Web.Extensions dll and my problems start there. Project builds fine, but when I try to…
Klark
  • 8,162
  • 3
  • 37
  • 61
13
votes
1 answer

Is it possible to create table-valued *methods* in a SQL CLR user-defined type?

I have a CLR UDT that would benefit greatly from table-valued methods, ala xml.nodes(): -- nodes() example, for reference: declare @xml xml = '12510' select c.value('.','int') as id from @xml.nodes('/id') t (c) I…
Peter Radocchia
  • 10,710
  • 2
  • 34
  • 56
13
votes
2 answers

Should I run F# in SqlClr?

I need to run .Net code in Sql and I'm trying to decide between F# and C#. I'm doing more and more code in F# nowadays so if it's not too impractical, I'd like it to be F#. Is it possible to coerce VS2010 to deploy my F# assemblies (and their…
Robert Jeppesen
  • 7,837
  • 3
  • 35
  • 50
1
2
3
66 67