sqlclr

CLR Stored Procedure with C# throwing errors

好久不见. 提交于 2019-12-24 04:12:27
问题 Hi I am working on making a CLR stored procedure using C#, for which I am learning through examples. Below is what I am trying now public static void GetProductsByPrice(int price) { SqlConnection connection = new SqlConnection("context connection=true"); connection.Open(); string commandText = "SELECT * FROM Products WHERE PRICE < " + price.ToString(); SqlCommand command = new SqlCommand(commandText, connection); SqlDataReader reader = command.ExecuteReader(); // Create the record and specify

Is “CLR Integration” enabled at a database level or the server/instance level?

匆匆过客 提交于 2019-12-24 03:33:44
问题 I am trying to understand whether enabling CLR enables it at a database-level or server-level / instance-level. The Online books are not clear at all, what happens if I enable CLR using this command, would it be enabled across all of the servers?? sp_configure 'clr enabled', 1 GO RECONFIGURE GO 回答1: CLR Integration is enabled at the server level (by the sp_configure 'clr enabled', 1 code you posted). Assemblies are loaded at the database level. CLR Stored Procedures and Functions are created

Storing WCF rest request data with SQL Server stored procedure

被刻印的时光 ゝ 提交于 2019-12-24 03:05:24
问题 I have a simple interface in my WCF service with one method which gets a myRequest parameter public interface IService { [OperationContract] string MyOperation(myRequest request); } When I'm posting the data from the client, the content type is application/json , so the request body auto deserialise into myRequest object. myRequest is a WCF DataContract : [DataContract] public class myRequest { string id; string name; List<Phone> phones [DataMember] public string Name { get; set; }

Storing WCF rest request data with SQL Server stored procedure

点点圈 提交于 2019-12-24 03:05:02
问题 I have a simple interface in my WCF service with one method which gets a myRequest parameter public interface IService { [OperationContract] string MyOperation(myRequest request); } When I'm posting the data from the client, the content type is application/json , so the request body auto deserialise into myRequest object. myRequest is a WCF DataContract : [DataContract] public class myRequest { string id; string name; List<Phone> phones [DataMember] public string Name { get; set; }

Creating a table method on a user defined type (like like 'nodes' on the XML data type)

北城以北 提交于 2019-12-24 02:21:57
问题 I've created working SQLCLR-based user defined table-valued functions as well as user defined types. What I want now is a method on a SQLCLR UDT that returns a table, similar to the nodes method on the XML data type. The TableDefinition and FillRowMethodName properties of the SqlMethod attribute / decoration seem to imply that it should be possible, but nothing actually works. When I call the method like this (which I expect to fail): SELECT @Instance.AsTable(); I get: invalid data type which

SQL Server not finding serialization assembly

99封情书 提交于 2019-12-23 17:14:51
问题 I'm trying to deploy an UpdateContries SQL CRL Procedure which calls a Web Service, following help found here http://www.elzaris.co.za/using-web-services-in-sql-server-clr-assemblies/ http://msdn.microsoft.com/en-us/library/84b1se47.aspx footheory.com/blogs/bennie/archive/2006/12/07/invoking-a-web-service-from-a-sqlclr-stored-procedure.aspx So basically I have a Visual C# SQL CLR Database Project on Visual Studio 2010 with a simple Procedure that calls an external Web Services which was added

What can I do to improve performance of my pure User Defined Function in SQL Server?

不羁岁月 提交于 2019-12-23 14:38:11
问题 I have made a simple, but relatively computationally complex, UDF that queries a rarely changing table. In typical usage this function is called many many times from a WHERE clauses over a very small domain of parameters. What can I do to make my usage of the UDF faster? My thoughts are that there should be some way to tell SQL Server that my function returns the same result with the same parameters and thus should be memoized. There doesn't seem a way to do it within the UDF because they are

Processing multiple results from CLR stored procedure in T-SQL

≯℡__Kan透↙ 提交于 2019-12-23 12:35:35
问题 I have some complex algorithm written in C# as CLR Stored procedure. Procedure is not deterministic (it depends on current time). The result of procedure are two tables. I didn't found any solution how to process multi-results from stored procedures in T-SQL. The performance of this procedure is key (procedure is called every ~2 seconds). I found the fastest way how to update tables is: UPDATE [db-table] SET ... SELECT * FROM [clr-func] It's much faster then update db-table from CLR procedure

Using .Net 3.5 assemblies SQL 2005 CLR?

落爺英雄遲暮 提交于 2019-12-23 10:06:50
问题 I have a CLR stored procedure that references an assembly created in VS 2008 that uses Linq. Lets call this assembly 'MyLib'. I can't seem to get 'MyLib' into my SQL 2005 database. I do the following: CREATE ASSEMBLY [MyLib] FROM 'C:\MyLib\bin\Release\MyLib.dll' WITH PERMISSION_SET = UNSAFE GO But I get the error: Assembly 'MyLib' references assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server

Using .Net 3.5 assemblies SQL 2005 CLR?

有些话、适合烂在心里 提交于 2019-12-23 10:05:48
问题 I have a CLR stored procedure that references an assembly created in VS 2008 that uses Linq. Lets call this assembly 'MyLib'. I can't seem to get 'MyLib' into my SQL 2005 database. I do the following: CREATE ASSEMBLY [MyLib] FROM 'C:\MyLib\bin\Release\MyLib.dll' WITH PERMISSION_SET = UNSAFE GO But I get the error: Assembly 'MyLib' references assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server