sqlclr

Use .NET dll as COM

和自甴很熟 提交于 2019-12-13 06:59:11
问题 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 client to consume the web service written for .NET 4. After playing around with some workaround to try to get SQL Server to recognize a .NET 4 DLL I decided to simply create a .NET 2 CLR stored procedure and use a wrapper class written in .NET 4

“Error converting data type nvarchar to int” when executing Stored Procedure and reading return value

混江龙づ霸主 提交于 2019-12-13 04:04:44
问题 I have a clr stored procedure which has an output value I am calling the sp from a vb.net app with the code below. I am getting an error that says 'Error converting data type nvarchar to int. 1125092|63688|Ok' the values are exactly what I am expecting back from the sp but I can't understand why I am getting a convertion error can anyone help with this. Code Calling the sp: Try Dim CN As New SqlConnection CN.ConnectionString = My.Settings.myConnection CN.Open() Dim Profile As String = "40T"

Passing huge amounts of data as an hexadecimal (0x123AB…) parameter of a clr stored procedure in sql server

霸气de小男生 提交于 2019-12-13 03:35:55
问题 I post this question has followup of This question, since the thread is not recieving more answers. I'm trying to understand if it is possible to pass as a parameter of a CLR stored procedure a large amount of data as "0x5352532F...". This is to avoid to send the data directly to the CLR stored procedure, instead of sending ti to a temporary DB field and from there passing it as varbinary(max) parmeter to the CLR stored procedure. I have a triple question: 1) is it possible, if yes how? Let's

Can I use SQLCLR stored procedure to update a column of a database table ( using some compiled dll)

血红的双手。 提交于 2019-12-13 02:50:25
问题 I wanted to update the values of a few columns of a database table, using queries or stored procedure, but wanted to use my C# library to alter the value. For eg, I want the columns A,B,C of table T to be replaced with Encrypt(A), Encrypt(B) and Encrypt(C) where Encrypt is a part of a C# library. I could have done it in a simple console application, but I have to do this process for a lot of columns in lot of tables. Could I use a SQLCLR stored procedure / query to do this process in SQL

System.InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods

半城伤御伤魂 提交于 2019-12-13 02:35:11
问题 I have a SQL CLR trigger written in C# 4.0 and deployed on SQL Server 2014. Whenever an insertion happens in a table in SQL Server, this CLR trigger's job is to import that row in an Oracle database. So basically I have to import data in Oracle database whenever an insert query is fired on a table in SQL Server 2014. This is my first CLR SQL trigger project and below is what I am doing: [SecurityCritical] [OraclePermission(System.Security.Permissions.SecurityAction.Assert, Unrestricted = true

Database Project, Assembly was not found in the SQL catalog

♀尐吖头ヾ 提交于 2019-12-12 21:36:41
问题 I have a SQL Server Database project in Visual Studio 2013. This project refer to another project called BusinessLayer . BusinessLayer project has reference to System.Component.DataAnnotations and DataAnnotations is in .NET framework dll folder "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.ComponentModel.DataAnnotations.dll" I also write a SQL CLR Trigger in DB Project, and when I deploy the database project, I got this error: SQL72014: .Net

SQL CLR Trigger - get Target / Table name

拥有回忆 提交于 2019-12-12 20:47:02
问题 Track column changes - single SQL CLR Trigger for multiple Targets/Tables SQL CLR Trigger: Is there a way to get Target / Table name from CLR code? Purpose: I'm building a universal SQL CLR Trigger to track column changes in multiple Tables. Info: The same CLR trigger can be bound to multiple Tables. As long as CLR Trigger is bound to a Table, it fires just fine on any Table no matter what Target/Table was specified in CLR Trigger Attribute. It means I can create 1 CLR Trigger and use it for

Automatically implemented properties must define both get and set accessors

 ̄綄美尐妖づ 提交于 2019-12-12 20:23:44
问题 SQLCLR Visual Studio 2015 I'm new to writing CLR code. I'm getting the following error when compiling a SQL CLR Function I'm using the .Net Coordinates library. The code in question is public Datum.Datum Datum { get; } The same library when compiled in a C# console application (not CLR) builds and executes successfully using Visual Studio 2015. My understanding is that by using Visual Studio I'm using C# v6. Could the .sqlproj be forcing the use of a earlier version of C#? 回答1: The main issue

SQL Server: How to copy a file (pdf, doc, txt…) stored in a varbinary(max) field to a file in a CLR stored procedure?

你。 提交于 2019-12-12 20:08:43
问题 I ask this question as a followup of this question. A solution that uses bcp and xp_cmdshell, that is not my desired solution, has been posted here. I am new to c# (since I am a Delphi developer) anyway I was able to create a simple CLR stored procedure by following a tutorial. My task is to move a file from the client file system to the server file system (the server can be accessed using remote IP, so I cannot use a shared folder as destination, this is why I need a CLR stored procedure).

SqlDependency vs SQLCLR call to WebService

只愿长相守 提交于 2019-12-12 19:04:37
问题 I have a desktop application which should be notified on any table change. So, I found only two solutions which fits well for my case: SqlDependency and SQLCLR . ( I would like to know if there is better in .NET stack ) I have built the both structure and made them work. I only able to compare the duration of a s̲i̲n̲gl̲e̲ response from SQL Server to the client. SqlDependency Duration: from 100ms to 4 secs SQLCLR Duration: from 10ms to 150ms I would like this structure to be able to deal with