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
1 answer

Debug a CLR Table Value Function in Visual Studio 2010

I have a SQL Server 2008 R2 CLR Database project with a table value function. The table value function runs select queries in order to preform it's logic. I want to debug this in VS 2010 so I can step through my code but for the life of me I can't…
0
votes
1 answer

How to select rows inside a CLR stored procedure in MS SQL Server 2008?

Following along with an example I found on the internet, I wrote the following C# code that implements a CLR stored procedure in MS SQL Server 2008: public class Class1 { [Microsoft.SqlServer.Server.SqlProcedure] public static void…
Vivian River
  • 31,198
  • 62
  • 198
  • 313
0
votes
1 answer

SQL SERVER get hostname and path but not parameters

I have to get the hostname & pathname from an URL using regular expression. URL can be in the form of a) http://test.com/mary/archive/project.aspx --> I want http::/test.com/mary b) http://www.testmary.com/company --> I want…
user2726975
  • 1,285
  • 3
  • 17
  • 26
0
votes
1 answer

Local ReportViwer 2012 Deployment with ClickOnce

I have a C#.Net WinForm App that uses few reports, the dataset made local and shown by report. So I am deploying this app with ClickOnce . In Prerequisites I have set. Report Viewer 2012 . .Net 4. SQL CLR x64. SQL CLR x86. That works fine on local…
kawafan
  • 231
  • 1
  • 7
  • 16
0
votes
2 answers

How to get physical path of a web application (by name, at runtime) from within the SQL CLR?

I would like to use Microsoft.Web.Administration.dll from within the SQL Server CLR in order to get the physical path of a specific web application at runtime, but the DLL is not available or tested in SQL Server, and adding it would require adding…
Triynko
  • 18,766
  • 21
  • 107
  • 173
0
votes
2 answers

SQL CLR Aggregate incorrectly returning null

I've added a user defined aggregate to my database for computing the product of a group. The code was taken essentially verbatim from here. I'm using the function to calculate the lifetime to date returns of financial instruments for which I have…
Will Pan
  • 282
  • 1
  • 10
0
votes
1 answer

Why SQL-CLR code installs correctly only on one database and not on any other of the same SQL Server?

I've published from Visual Studio the same CLR database function to both the Staging and Live db instances, they both live on the same MS SQL Server which is version 11.0.2100.60. They both install fine however when I run a same function on the…
Giuseppe Romagnuolo
  • 3,362
  • 2
  • 30
  • 38
0
votes
1 answer

Get name of "parent" database from assembly

I have a SQL CLR stored procedure written in c# (.NET4). Its purpose is to allow a trigger on a table in a SQL Server 2012 database to call a web service which then processes the data in that table. However, there are several different databases…
Mansfield
  • 14,445
  • 18
  • 76
  • 112
0
votes
1 answer

The server may be running out of resources in aggregate functiond

I try to copy this code and to deploy this function to my server. When I try to create the function I get the message below. It's very strange to me because I don't use any unsafe resource. I tried to run this with execute as 'dbo', and it's not…
David Weinberg
  • 1,033
  • 1
  • 13
  • 29
0
votes
1 answer

SQL CLR UDF Returning Type Name ()

I am using a Visual Studio 2012 Database project with a CLR UDF (below). For some reason, after deploying it to the database, I call the function and I get the type name returned instead of the expected result. public partial class…
Gabriel McAdams
  • 56,921
  • 12
  • 61
  • 77
0
votes
1 answer

SQL CLR Aggregate function Error Handling

I have a user defined CLR aggregate function that can potentially throw an error. I would like to know how to handle an error if one occurs in my query. The function is performing an IRR calculation similar to that which Excel does, ie. an…
0
votes
1 answer

Merging a decrypted search of items within a LINQ query

I have the following search query: IQueryable files = GetFiles(f => f.Clients.Any(fc => fc.Contacts.Any(c => c.Companies.Any(x => x.Name.Contains(searchText))))); Unfortunately the search for Companies.Name will never work because the Name is…
gotnull
  • 26,454
  • 22
  • 137
  • 203
0
votes
1 answer

Execute decrypt function on LINQ query

If I have the following query where Companies.Name is encrypted: Obviously executing the following query is going to be invalid because we're searching against encrypted names. IQueryable files = GetFiles(f => f.Clients.Any(fc =>…
gotnull
  • 26,454
  • 22
  • 137
  • 203
0
votes
0 answers

How can I modify my string comparison algorithm to reduce the 'significance' of digits?

I have a SQL CLR table valued function which accepts two string parameters for the purpose of comparing company names and returning a match score outcome. This is the c# function that I'm using to determine the likelyhood of two strings…
Abu Dina
  • 207
  • 1
  • 5
  • 12
0
votes
0 answers

TSQL 'create assembly' not working

I've added a simple reference to my SQL Server 2008 CLR project (hosted in VS2012). If I compile naively, it throws this: SQL06503: Assembly 'microsoft.sharepoint, version=14.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c.' was not found…
Reinderien
  • 11,755
  • 5
  • 49
  • 77