sqlclr

SQL Server CLR integration with 3rd party SDK: Error on missing assembly System.Drawing

北城余情 提交于 2020-01-04 07:35:47
问题 I am developing a solution that will interface with the SDK of a 3rd party application and ultimately create a dataset to migrate data into a destination database on our SQL Server 2014 instance. This interface is via a SQL Server CLR Stored procedure. the following references have been used in creating the CLR assembly on the C# side: using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using (3rd party SDK); using System

SQL Server CLR integration with 3rd party SDK: Error on missing assembly System.Drawing

旧街凉风 提交于 2020-01-04 07:35:13
问题 I am developing a solution that will interface with the SDK of a 3rd party application and ultimately create a dataset to migrate data into a destination database on our SQL Server 2014 instance. This interface is via a SQL Server CLR Stored procedure. the following references have been used in creating the CLR assembly on the C# side: using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using (3rd party SDK); using System

What is a good approach in MS SQL Server 2008 to join on a “best” match?

偶尔善良 提交于 2020-01-04 06:15:29
问题 In essence I want to pick the best match of a prefix from the "Rate" table based on the TelephoneNumber field in the "Call" table. Given the example data below, '0123456789' would best match the prefix '012' whilst '0100000000' would best match the prefix '01'. I've included some DML with some more examples of correct matches in the SQL comments. There will be circa 70,000 rows in the rate table and the call table will have around 20 million rows. But there will be a restriction on the Select

SQL CLR Function to return nullable boolean

て烟熏妆下的殇ゞ 提交于 2020-01-03 18:58:21
问题 I'm trying to write a SQLCLR function that will return a nullable boolean value. If I declare the function like this: public static SqlBoolean? IsTimeZoneDST(SqlString timeZone) then I get an error when attempting to use the assembly saying the types for the return value do not match. Is there something I am missing or is it not possible to return a nullable boolean in this instance? 回答1: All of the .NET Sql* types have a .Null field (static property) that creates a new instance of what will

How to resolve VS2013 Error SQL71501: Procedure X has an unresolved reference to Assembly Y?

橙三吉。 提交于 2020-01-03 18:32:10
问题 As a part of our effort to upgrade from Visual Studio 2010 to 2013, I am looking at a couple of SQL Server CLR stored procedures that need EXTERNAL access, and for this purpose are isolated in a separate assembly. I've got almost everything to build with little difficulty, but this is giving me some trouble. Since the assembly in question uses web references which the new .sqlproj project type apparently does not like at all, and to be able to proceed, we decided to just build that assembly

Schema for CLR Stored Procedure During Deployment

送分小仙女□ 提交于 2020-01-03 14:05:52
问题 I'm interested in configuring Visual Studio (2010) so that when deploying C# CLR Database projects, it puts stuff in schemas other than DBO. I understand I can update the function/procedure/etc... wrappers it creates manually to make this happen: CLR Stored Procedures: how to set the schema/owner? However, I'd really like to automate the process somehow. If anybody knows, I'd really appreciate the answer! 回答1: It should be mentioned that this question is obsolete as of Visual Studio 2012

Can I pass arguments to an external (CLR) SQL Server trigger?

戏子无情 提交于 2020-01-03 03:19:05
问题 I have a trigger in SQL Server, but I need to pass arguments to the CLR code, i.e., information not provided in the trigger context. Is something like this even possible? CREATE TRIGGER MyTrigger ON MyTable FOR INSERT AS EXTERNAL NAME MyAssembly.MyNamespace.MyTriggerHandler("Foo", "Bar") These arguments would be static, of course. The number of argument permutations is discrete, but creating a separate class or function in the CLR assembly for each would be unwieldy, and would require a

SQL Server CLR : how to call WCF Service In CLR SQL stored procedure in Visual Studio 2013 database project

爱⌒轻易说出口 提交于 2020-01-02 21:47:07
问题 I have Visual Studio 2013. I created a database project. I added a CLR stored procedure to that project, and I want to call a WCF service from it. Can anyone help me? I want be able to change service address without changing my assembly, similar to what I can do in web.config with the endpoint section of my WCF client config. 回答1: I found this after a lot of searching and spend very much time on this in VS 2014 Create Database Project Called "CLR_Test" Create Library For WCF Client "CLR

Best way to handle connection when calling a function from a Console App or SQLCLR object with (“Context Connection=true”)

时光总嘲笑我的痴心妄想 提交于 2020-01-02 18:36:59
问题 I have the following type of code in my data layer, which can be called from a console app, windows app, etc, with the proper connection string being read from the corresponding caller's App.Config file: public static udsDataset GetDataset(int datasetID) { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; string sql = @"select * from Dataset WHERE DatasetID=@datasetID"; using (SqlConnection conn = new SqlConnection(connectionString)) { //

Best way to handle connection when calling a function from a Console App or SQLCLR object with (“Context Connection=true”)

邮差的信 提交于 2020-01-02 18:36:03
问题 I have the following type of code in my data layer, which can be called from a console app, windows app, etc, with the proper connection string being read from the corresponding caller's App.Config file: public static udsDataset GetDataset(int datasetID) { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; string sql = @"select * from Dataset WHERE DatasetID=@datasetID"; using (SqlConnection conn = new SqlConnection(connectionString)) { //