sqlclr

How to execute SQLCLR UDF added directly to SSDT sqlproj and resolve reference error SQL71501

跟風遠走 提交于 2019-12-11 09:28:51
问题 I have been trying to find the answer to this simple question - but so far couldn't figure it out. Let say I have MyDb.sqlproj, with various sql content (sprocs, views, trigger, etc). I have added a new UDF through Add-> New item -> SQL CLR C#, User Defined Function. For example: namespace MyNameSpace { public class MyClass { [SqlFunction(DataAccess = DataAccessKind.Read)] //I use different attributes here, but it doesn't matter public static int Method1() { return 0; } } } In MyDb.sqlproj

Calling an MVC3 action from a SQL CLR stored procedure

夙愿已清 提交于 2019-12-11 08:43:39
问题 I'm working on a CLR stored procedure that calls a controller action in an ASP.NET MVC3 application that uses Windows Authentication (everything else is disabled). The Web server is IIS 7.5 running on Windows Server 2008 R2 Standard. The database server is SQL Server 2008 R2 Enterprise Edition. Here is the code of the CLR proc: [SqlProcedure] public static void UpdateModels() { Uri uri = null; HttpWebRequest rq; HttpWebResponse rsp; Uri.TryCreate("http://testserver/RPM/Configuration

SQL Server CLR to embed business logic and schedule execution with SQL Server Agent

你。 提交于 2019-12-11 07:57:41
问题 I have the business logic of an workflow-like application in a C# class library, but at end of each month certain process in the library needs to be invoked, i thought that the ideal mechanism to invoke this scheduled execution is using the Sql server agent (sql job preferably, althought i'm open to even go into SSIS hell if its absolutely required), but the question is how do i invoke the process of the application library from the sql job? the application library is also used from asp.net

How do I find a ASP.NET hosting company that supports SQL Server with CLR enabled?

允我心安 提交于 2019-12-11 06:36:45
问题 So I developed a web application in ASP.NET and SQL Server 2008. Part of the SQL code I implemented as a .NET assembly (instead of t-sql) because it is performing intense calculations that are better written in C#. Now I am ready to deploy my application, but I am stuck looking for a hosting company that allows this. Scratch out Discount ASP (see this forum post). I tried emailing other hosting companies and I either get no reply or they say they will not support it. Any recommendations? What

Could not load file or assembly 'System.Data.DataSetExtensions

前提是你 提交于 2019-12-11 06:26:10
问题 This is my first time working with SQL Server 2012 and I'm having a problem getting access to the database. I did a backup and restore from a SQL Server 2008 R2 database, set the logins and permissions, set the database to trustworthy and enabled clr. I'm using a web application (IIS, ASP.Net) to connect to the database. When I point the web server to the new database I get the following error. When I point it to a copy of the database on a SQL Server 2008 R2 machine, it connects. I’m running

Logging not Persisting When Exception Occurs in Method Executed in a Trigger

亡梦爱人 提交于 2019-12-11 04:57:55
问题 I have been stuck all day on this issue and cannot seem to find anything online pointing me to what might be causing it. I have the below logging method in a Logger class and the below code calling the logger. When no exception occurs all the log statements work perfectly, however when an exception occurs the log statements do not run at all (however they do run from the web service call). Logger Log Method: public static Guid WriteToSLXLog(string ascendId, string masterDataId, string

SQL Server 2016: CREATE ASSEMBLY for assembly 'System.ServiceModel' failed

家住魔仙堡 提交于 2019-12-11 04:15:30
问题 I am trying to import System.ServiceModel.dll for one of my projects in getting the following: CREATE ASSEMBLY for assembly 'System.ServiceModel' failed because assembly 'microsoft.visualbasic.activities.compiler' is malformed or not a pure .NET assembly. SQL Server is running on Windows Server 2012 R2. Is there a fix for this issue? I am aware of similar issues with SQL Server 2012? How about SQL Server 2014? Thanks in advance 回答1: No, there is no fix that will allow for loading ServiceModel

Using Entity Framework 6 / EF Core inside SQL CLR

荒凉一梦 提交于 2019-12-11 04:08:55
问题 Microsoft Azure Tech support has confirmed that all version of .Net 4.XX including 4.7.2 is supported in SQL Server Managed Instance CLR. We're transforming some portion of Business layer with 4.7.2 and latest EF 6.2 Use Entity Framework in CLR Stored procedure https://patrickdesjardins.com/blog/how-to-use-third-party-dll-reference-in-a-sql-clr-function Therefore in order to leverage existing investment in well tested code we want to move certain business layer into DB. However we ran into

How can I get the definition of a SQL CLR function from the database

谁说我不能喝 提交于 2019-12-11 02:17:56
问题 The code I was given for an SQL CLR project contains one function where the .net implementation is invalid. However I have been able run a query to confirm that there is a function with the name of the invalid one on the server. Schema name assembly_name assembly_class assembly_method permission_set_desc type_desc dbo ConvertFromUTC database AppName.Database.Functions ConvertFromUTC UNSAFE_ACCESS CLR_SCALAR_FUNCTION That's enough information to confirm the deployed version is a scalar

Creating socket inside a SQL-CLR trigger or stored procedure

家住魔仙堡 提交于 2019-12-11 01:35:20
问题 I have a SQL-CLR trigger in SQL Server 2008 that sends out message to socket server. It works fine but I need the TCP client to stay connected to the server it communicates with. In order to do this I have to make some thread that stays alive. So I created a thread added the message to queue, I see client connecting but SQL Server kicks out before the client is able to process the queued message and send it to tcp server. The purpose of this application is to send what fields and some values