sqlclr

SQL CLR Web Service Call: Limiting Overhead

纵然是瞬间 提交于 2019-11-28 09:58:25
问题 I'm attempting to improve query performance for an application and I'm logically stuck. So the application is proprietary and thus we're unable to alter application-side code. We have, however, received permission to work with the underlying database (surprisingly enough). The application calls a SQL Server database, so the current idea we're running with is to create a view with the same name as the table and rename the underlying table. When the application hits the view, the view calls one

CLR SQL Assembly: Get the Bytestream?

谁说我不能喝 提交于 2019-11-28 09:07:27
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 CREATE ASSEMBLY command . But what I have yet to find is how to get that byte stream/varbinary_literal/ varbinary_expression/assembly bits value. I haven't found any consistent terminology, and what I keep finding in using Load() . It's just a hex representation of the dll. This bit should do the trick: static string GetHexString(string assemblyPath) {

SQL Server 2008 and HashBytes

两盒软妹~` 提交于 2019-11-28 08:31:26
I have quite a large nvarchar which I wish to pass to the HashBytes function. I get the error: "String or binary would be truncated. Cannot insert the value NULL into column 'colname', tbale 'table'; column does not allow nulls. UPDATE fails. The statement has been terminated." Being ever resourceful, I discovered this was due to the HashBytes function having a maximum limit of 8000 bytes. Further searching showed me a 'solution' where my large varchar would be divided and hashed seperately and then later combined with this user defined function: function [dbo].[udfLargeHashTable] (@algorithm

How to register System.DirectoryServices for use in SQL CLR User Functions?

爷,独闯天下 提交于 2019-11-28 08:29:03
I am porting an old 3 2-bit COM component that was written in VB6 for the purpose of reading and writing to an Active Directory server. The new solution will be in C# and will use SQL CLR user functions. The assembly that I am trying to deploy to SQL Server contains a reference to System.DirectoryServices . The project does compile without any errors but I am unable to deploy the assembly to the SQL Server because of the following error: Error: Assembly 'system.directoryservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.' was not found in the SQL catalog. What are the

FileLoadException / Msg 10314 Error Running CLR Stored Procedure

久未见 提交于 2019-11-28 05:45:42
Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated. Msg 10314, Level 16, State 11, Line 1 An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: System.IO.FileLoadException: Could not load file or assembly 'orders, Version=0.0.0.0, Culture=neutral,

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

元气小坏坏 提交于 2019-11-28 05:28:46
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 a number of possible solutions but just can't seem to find that one neat solution that feels right. The kind of post processing is fairly heavy as well, so much so that the windows listener service is actually going to pass the processing over to a number of machines. However this part of the application is already up and running, completetly

Does SQL Server CLR Integration support configuration files?

一曲冷凌霜 提交于 2019-11-28 00:40:38
问题 I use SQL Server CLR Integration to create an ASSEMBLY. Load Command: CREATE ASSEMBLY TcpClr FROM 'G:\TcpClrTest.dll' WITH PERMISSION_SET = UNSAFE Without App.Config The dll code contains : string ip=ConfigurationManager.AppSettings["connection"].ToString(); Also the App.config contains : <appSettings> <add key="connection" value="127.0.0.1"/> </appSettings> But when I execute the PROCEDURE,the SQL Server shows an error System.NullReferenceException Does SQL Server CLR Integration support App

Call web service from SQL CLR?

本秂侑毒 提交于 2019-11-28 00:05:20
I have a SQL Server 2012 stored procedure that returns a table. I have to modify that SP to add an additional value to the returned table. Unfortunately, that added value comes from a call to a web-service. From my research, I gather the main ways to do this are using the OLE Automation procedures (sp_OA...) in SQL, or a SQLCLR stored procedure. Given the security context in which the sp_OA... procedures run, the single return value is a VARCHAR(10) registration key, and calls to the service are few (ten to twenty per hour), I'm guessing the SQLCLR method is the way to go. Also, the web

How is a CLR table valued function 'streaming''?

一世执手 提交于 2019-11-27 23:45:36
The MSDN Docs on table-valued Sql Clr functions states: Transact-SQL table-valued functions materialize the results of calling the function into an intermediate table. ... In contrast, CLR table-valued functions represent a streaming alternative. There is no requirement that the entire set of results be materialized in a single table. The IEnumerable object returned by the managed function is directly called by the execution plan of the query that calls the table-valued function, and the results are consumed in an incremental manner. ... It is also a better alternative if you have very large

Sending HTTP POST request from SQL Server 2012 or SQL CLR C#

為{幸葍}努か 提交于 2019-11-27 23:08:07
Is there a generally accepted standard way for sending HTTP requests from SQL Server 2012? What I am trying to do is to use a remote server to process a search query and then insert the results back into the SQL Server 2012 database. The remote server offers a web api that accepts POST requests, with JSON content. I have a working solution, which however requires to load several assemblies into SQL Server. Some of these assemblies are not fully supported (e.g. System.Net.Http.dll), giving a warning like this: Warning: The Microsoft .NET Framework assembly 'system.net.http, version=4.0.0.0,