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

Getting error with UDF SQL CLR which returns Datetime result

I have defined two functions 1) Returns String [Microsoft.SqlServer.Server.SqlFunction] public static SqlString TestScalarFunction() { return new SqlString ("RJ"); } 2) Returns Datetime [Microsoft.SqlServer.Server.SqlFunction] public static…
Rahul
  • 2,309
  • 6
  • 33
  • 60
0
votes
1 answer

Getting error when using UDF with SQL Query

I have made a CLR by using SQL Project Templates into Visual studio using language C# as:: [Microsoft.SqlServer.Server.SqlFunction()] public static SqlDateTime ScalarUDF(SqlInt64 CompanyID) { SqlInt64 temp = CompanyID; …
Rahul
  • 2,309
  • 6
  • 33
  • 60
0
votes
1 answer

Bitwise OR function in SQL Server

I want to create a custom bitwise OR aggregate function. I want to use it like the built in aggregate functions (MIN, MAX etc.) SELECT dbo.bitwise_or(bit_string) FROM table where bit_string is a nvarchar(3) so for example if the table contains two…
jockefe
  • 11
  • 4
0
votes
3 answers

Executing a VB.NET DLL From SQL Server

Objective: we want to write a DLL using VB.NET 2008 using .Net 3.5 that performs an HTTP request we then want to call the DLL From SQL Server 2005 (in a trigger) and pass the DLL some variables and get a return value. Where im at in the process. I…
Anthony
  • 1
  • 1
  • 1
0
votes
2 answers

SQLCLR: allegedly missing dependent assembly that is actually installed though

I created a WCF procedure that employs a company internal web service that comes with a whole bunch of assemblies to be deployed. That worked fine on my local 2008 R2 32-bit so far. When trying to deploy the involved assemblies on a SQL Server 2008…
Prefect73
  • 321
  • 3
  • 14
0
votes
0 answers

Quickly update and do statistical normalization of data SQL

I have a SQL-Server table which needs to be updated via a SQLCLR function. An update to a single row will need to trigger table-wide update. I was wondering how to properly perform the update and normalize the table. The main problem I see is…
Faraday
  • 2,904
  • 3
  • 23
  • 46
0
votes
1 answer

SQL Server 2008 CLR aggregate function

I have been looking at using a CLR aggregate to perform some complex financial calculations on a series of data, but despite reading many articles on the subject and much fiddling I can't quite figure it out. My input is a series of dates and…
woggles
  • 7,444
  • 12
  • 70
  • 130
0
votes
1 answer

SQLCLR Trigger/Procedure in LocalDB?

I'm trying to get SQL CLR procedures working with LocalDB (2012). My trigger and procedure (below) are never called. I'm creating the LocalDB with Entity Framework 6. Is the trigger supposed to work in this scenario? using System; using…
Brannon
  • 5,324
  • 4
  • 35
  • 83
0
votes
2 answers

Using CLR to get value from registry

Is there a way to get a value from the registry using a CLR procedure that doesnt involve having to registry Microsoft.Win32 as an assembly in SQL Server? I am looking to get the DigitalProductId (I will need to decode it to a string) from the…
Coolcoder
  • 4,036
  • 6
  • 28
  • 35
0
votes
1 answer

Fully transparent CLR types in SQL Server

I would like to take advantage of User Defined Types that can be created in a .NET assembly and then imported to SQL Server to perform a transparent operation like for example encryption. Encryption would be handled in Parse method while decryption…
nan
  • 19,595
  • 7
  • 48
  • 80
0
votes
1 answer

How to programmatically obtain list of stored procedures and functions associated with an assembly

I started with list of all CLR stored procedure list: select * from sys.procedures where type_desc = 'CLR_STORED_PROCEDURE' But I want to obtain the list of all stored proc and functions associated with a specific assembly. Thank you for your…
bjnr
  • 3,353
  • 1
  • 18
  • 32
0
votes
2 answers

SQL Server 2008 R2 Correct use CLR Assemblies

We have a Windows app that interrogates two databases then makes some files and puts them on an FTP site. It also recovers files from the FTP site and updates the databases. This app is all about the data and the files hence my leaning towards the…
Bob Clegg
  • 553
  • 2
  • 9
  • 21
0
votes
2 answers

How To Programmatically Publish A SQL CLR Function During An Entity Framework DbContext Seed?

I have a SQL Server Project in my Solution (VS 2012/.Net 4.5). The only reason for that project is that I needed to create a CLR function that I can call from some of my stored procedures. It works great and life is awesome. However, I have to…
Grandizer
  • 2,819
  • 4
  • 46
  • 75
0
votes
1 answer

How do I use EF4 in SQLCLR (SQL Server 2012)?

I've a project that uses EF4 on the client side to talk to a SQL Server db. On that DB there's a bunch of SPs that do operations on records and return subsets of records. Nothing particularly major, about the most intensive bit is generating a few…
Craig Graham
  • 1,161
  • 11
  • 35
0
votes
2 answers

Retrieve the sqlobject that fired the trigger in clr

I have a generic clr trigger which can be attached to different tables on insert, update, delete. e.g. [Microsoft.SqlServer.Server.SqlTrigger(Event = "FOR UPDATE, INSERT, DELETE")] public static void TriggerHandle() { DataTable dataTable = new…
ripahoratiu
  • 55
  • 2
  • 7