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

Best method to copy a file to the SQL Server machine

I am looking into copying a file from the client computer to the server computer. One path I've looked into was creating a CLR method which accepts a stream as input. Another suggestion I've had is to use the BCP utility, though I have been…
Luke G
  • 367
  • 1
  • 4
  • 20
0
votes
2 answers

Data access patterns in SQLCLR

I'm using SQLCLR in my project and, for the record, I'm very pleased with it. However, I can't find any good sources of information for good data access patterns. Usually I do communication between .net and SQL using stored procedures because I…
erikkallen
  • 33,800
  • 13
  • 85
  • 120
0
votes
1 answer

Passing entire rows to SQL CLR function/sproc

I have a process where I need to perform some complex string manipulation on a SQL table containing columns like Forename, Surname, Address1 etc To perform this data manipulation I have setup various SQL CLR C# functions but now I would like to pass…
0
votes
2 answers

Find how many words are the same in two strings

I have this function where I would like to compare two strings and then return how many words exist but the following isn't working. I always seem to get 0 for SameWordCount and 1 for MasterAddressWordCount Any ideas? // some more string cleaning …
Abu Dina
  • 207
  • 1
  • 5
  • 12
0
votes
1 answer

How to extract and port an "SQL Server 2008 database embedded CLR assembly" to a MySQL 5.5 database equivalent?

My Goal: To extract and port a SQL Server CLR assembly embedded in an SQL Server 2008 database to an equivalent supported by a MySQL 5.5 database. I have a SQL Server 2008 database which i am trying to port to MySQL 5.5. The database is part of an…
Steve Johnson
  • 3,054
  • 7
  • 46
  • 71
0
votes
1 answer

SQL CLR make sure finally block is executed

I have a SQL server CLR stored proc that is used to retrieve a large set of rows, then do a process and update a count in another table. Here's the flow: select -> process -> update count -> mark the selected rows as processed The nature of the…
Amila
  • 2,779
  • 1
  • 27
  • 31
0
votes
1 answer

Use .NET dll as COM

I have a somewhat convoluted issue where I need to call a WCF web service from a SQL Server 2005 stored procedure. While researching I discovered that the only version of .NET SQL Server 2005 will natively support it 2.0 - yet I needed to use a…
Mansfield
  • 14,445
  • 18
  • 76
  • 112
0
votes
1 answer

Potential performance issues when calling web service from SQL CLR

I have a need to call external web service on certain events in my application. I don't want to modify my application and make any dependencies of that external web service. So, I need to think of a way to do this with some sort of external…
buhtla
  • 2,819
  • 4
  • 25
  • 38
0
votes
1 answer

SQL Server Service Broker using DataSet

I am converting a console application to run from Service Broker in SQL Server 2005. The application makes heavy use of DataSet. Are DataSets supposed to work in SQLCLR? How do I define the connection to use? Is there any documentation about…
Oli
  • 1,762
  • 3
  • 19
  • 22
0
votes
1 answer

Unable to debug .Net Code. Could not attach to process. SQL CLR Remote Debugging

I'm trying to debug a CLR based StoredProcedure in Visual Studio 2012 RTM. I have a Sql Database Project. When I try to debug my script file using RightClick -> Execute with debugger it pop ups a warning about harmfulness of attaching a process and…
Pouyan
  • 2,849
  • 8
  • 33
  • 39
0
votes
2 answers

SQLCLR Nullable DATETIME2 in SSDT

I want to write an SQLCLR UDF that takes a DATETIME2 and returns a DATETIME2. The input and output should allow NULLs. I create an SQL Server Database Project (SSDT), configure it as VB language in its SQLCLR properties, and then add the following…
Jason Kresowaty
  • 16,105
  • 9
  • 57
  • 84
0
votes
1 answer

CLR SQL User Defined type pass list of ID to stored procedure

Many times in projects we pass a list of IDs from UI to stored procedure. Most solutions are based on creating the sql string split functions that creates temporary table and perform the some inner joinr with temp table. e.t. Did any one have…
Shmalex
  • 171
  • 2
  • 11
0
votes
1 answer

SqlBulkCopy in SQLCLR stored procedure?

I created SQLCLR stored procedure that retrieve large amount of data from external service. Can I bulk copy the data to a new table in the same SQLCLR stored procedure?
Yshayy
  • 325
  • 2
  • 10
0
votes
1 answer

MSBuild a SQL CLR Project with External Dependencies

I am tying to do msbuild (continuous integration) for a SQL CLR project in VS 2010/SQL Server 2005. The project builds correctly in VS, but I can't get it to build in msbuild since it needs a 3rd party external reference. The typical way to get…
cdub
  • 24,555
  • 57
  • 174
  • 303
0
votes
1 answer

What is meaning of WindowsIdentity

While studying SQL CLR stored procedure I came across following link Link for SQL Bulk Copy in CLR . In this link user has used WindowsIdentity currentIdentity = SqlContext.WindowsIdentity; WindowsImpersonationContext impersonatedIdentity =…
Sachin
  • 57
  • 1
  • 1
  • 11