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
0
votes
2 answers

Call SQLCLR from trigger or polling?

I have a table that will receive messages from a 3rd party software, I need a triggering mechanism to call my dotnet code. What are are the pros and cons of a trigger calling a SQLCLR which then could call a web service for example vs just having…
retslig
  • 888
  • 5
  • 22
0
votes
1 answer

SQL Server CLR - SqlDataRecord.SetValue InvalidCastException

I'm working on setting up a large set of stored procedures using SQL CLR. I'm currently in debugging mode. I'm trying to write a data set back to the client using SqlPipe. Here's my code: Dim metaData() As SqlMetaData = {New SqlMetaData("USERNAME",…
mbm29414
  • 11,558
  • 6
  • 56
  • 87
0
votes
1 answer

Getting results from SQLCLR

I have the following issue: I must have a DLL accessed from various clients inside the LAN, that resides in a the PC that hosts the SQL Server. I need to access this DLL from all the clients in order to have it return a legal-tax checksum. I thought…
PanosPlat
  • 940
  • 1
  • 11
  • 29
0
votes
1 answer

Error When Creating CLR Function

I've created an C# class that contains 2 static method and I successfully created an Assembly in SQL 2005. When I try to create a table-valued function from that Assembly I get the following error: Msg 6509, Level 16, State 36, Procedure , Line…
0
votes
1 answer

How to push SQLCLR updates to your (CI) server

I'm re-using some .NET code between SQL 2005 server and WinForm clients using SQLCLR. This code has dependencies beyond .NET 2.0 which means I have to add these assemblies on the server machine (e.g. CREATE ASSEMBLY). I'm trying to do this as part…
Brett Veenstra
  • 47,674
  • 18
  • 70
  • 86
0
votes
1 answer

SQL CLR return two new columns

I have a SQL CLR function which at the moment returns a string seperated by a comma. How would I code the statement to return two new columns into my resultset. For example Select A, B, MyCLRFunction(X,Y) C From MyTable Returns:- One Two …
general exception
  • 4,202
  • 9
  • 54
  • 82
0
votes
1 answer

CLR SP with unmanaged code

i have some code in C++ (www.NR.com functions), which i would like to use in SQL Server 2008R2 CLR SP. Tried to make a wrapper in C#, but no luck. Perhaps somebody has a working sample or manual how to make such wrapper and set all required…
Alex Dybenko
  • 510
  • 1
  • 4
  • 11
0
votes
1 answer

SQL CLR in which scenario will give better better performance?? we observed for string and mathematical operation.

We recently had a need to validate lot of address (strings) in SQL Server, t-sql code was showing latency we tried SQL CLR and wow! 700% performance improvement. We are looking at what other places we can use it??? I guess not all logic should be…
Pritesh
  • 1,938
  • 7
  • 32
  • 46
0
votes
1 answer

SQL-CLR stored procedure doesn't return value

I looked through Stackoverflow and found almost identical question here. It was asked a year ago and nobody answered it yet. Maybe I'll be more lucky than user1038334 and somebody will help me. I have a SQL CLR stored procedure which works fine for…
davidoff
  • 2,175
  • 3
  • 16
  • 23
-1
votes
1 answer

Webservice call failing inside SQL Clr code due to SSL

I am invoking a web Service call inside SQL Clr table valued function (C#). When the sql function is invoked following error is received "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure…
paranjai
  • 531
  • 2
  • 5
  • 26
-1
votes
1 answer

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 'value'c1,'000' c2 union all select '...'c1,''…
elle0087
  • 840
  • 9
  • 23
-1
votes
1 answer

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 using those functions to encrypt the data at…
Jitendra Pancholi
  • 7,897
  • 12
  • 51
  • 84
-1
votes
1 answer

How do I add parameters to my queries when using clr/c++ for multiple variables

I want to be able to add parameters to my queries to make my statements less vunerable to sql injections My code (Key parts are surrounded by ** as I cannot make code bold) OleDbConnection^ existingSqlConnection = nullptr; …
L.A
  • 21
  • 9
-1
votes
1 answer

How should I use SQL Server CLR to employ UDT compiled by C++/C

I got a question on how should I C++/C to deploy SQL Server User Defined Type to hold complex data structure. I am using VS2017 and SQL Server 2012. I'm kind of knowing how to do it using C#, while I prefer C++/C much more and it provide me faster…
Shore
  • 827
  • 9
  • 24
-1
votes
1 answer

Group concat with history in SQL Server

This post is not intended to start a discussion about the best method of group concatenation of strings in SQL Server because many articles have already done that. I'd like to use a method like this for the group concatenation piece itself:…
devinbost
  • 4,658
  • 2
  • 44
  • 57
1 2 3
66
67