sqlclr

(Unfixable) Assembly exists on SQL Server 2014 but it claims it doesn't have it

安稳与你 提交于 2019-12-20 04:04:06
问题 Update: this problem is not fixable: https://connect.microsoft.com/SQLServer/Feedback/Details/809697 I'm attempting to create a SQL CLR assembly with .net 4.5 and it's telling me it's missing system.servicemodel (even though it's in the .net assembly folders): Assembly 'MySQLCLRProject' references assembly 'system.servicemodel, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically

SQL CLR awaitable not getting executed

半世苍凉 提交于 2019-12-19 12:22:40
问题 It is my understanding that the awaitable completes the remaining part of the executing code when they return back from the wait. I am trying to get this to work in an sql clr, and this is not working as both awaited process and codes beneath it are not getting executed. In debug method, the control just returns after executing the await line. how can i make this work, as the requirement is for clr to be executed without blocking the main thread so that other work can continue well in the db.

SQL Server CLR UDF Parallelism redux

我的未来我决定 提交于 2019-12-19 04:08:06
问题 I have been researching SQL Server CLR UDFs and parallelism for some time. The general consensus seems to be that in SQL Server 2008 and later, a scalar value CLR UDF with DataAccessKind.None should allow parallel execution. However, when I use my scalar value UDF in my view in SQL Server 2012, it still kills parallel execution in joins and the like. Is there something special I need to add to my C# code or the T-SQL UDF definition to indicate that it is safe for parallel execution? Thanks.

Sql Server CLR load assembly failed

风流意气都作罢 提交于 2019-12-18 13:11:31
问题 I am trying to deploy an CLR TVF (table value function). In the code I am using JavaScriptSerializer to parse some JSON string, so I reference the System.Web.Extensions dll and my problems start there. Project builds fine, but when I try to register the dll I receive the following error: Assembly 'my_assembly_name' references assembly 'system.web.extensions, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35.', which is not present in the current database. SQL Server attempted

Extracting a .NET Assembly from SQL Server 2005

蓝咒 提交于 2019-12-18 10:28:09
问题 I am trying to help a personal friend (who now also is a client) with a SQL CLR related problem. He has a SQL Server with a database that has 3 .NET assemblies embeded in it. He asked me to help him extract the assemblies from within the database and save them as .dll files on the disk. Is this even possible? 回答1: Yes, this is possible. The actual binary representation of the assemblies live in the SQL catalog for your server. Namely, if you run a join between sys.assembly_files and sys

Difference between scalar, table-valued, and aggregate functions in SQL server?

天涯浪子 提交于 2019-12-18 10:26:36
问题 What is the difference between scalar-valued, table-valued, and aggregate functions in SQL server? And does calling them from a query need a different method, or do we call them in the same way? 回答1: Scalar Functions Scalar functions (sometimes referred to as User-Defined Functions / UDFs) return a single value as a return value, not as a result set, and can be used in most places within a query or SET statement, except for the FROM clause (and maybe other places?). Also, scalar functions can

How to create CLR stored procedure with Nvarchar(max) parameter?

谁说我不能喝 提交于 2019-12-18 08:35:40
问题 Is it possible to create CLR stored procedure in SQL Server CLR project having input parameterof type nvarchar(max)? If you define stored procedure: <Microsoft.SqlServer.Server.SqlProcedure()> _ Public Shared Sub MyProcedure(ByVal param1 As String) Then when you deploy it, param1 is of type NVarchar(4000). Is there a way to have it NVarchar(max)? 回答1: Define your parameter to be of type SqlChars, instead of string. See Handling Large Object Parameters in the CLR 回答2: You can use the SqlFacet

How to create CLR stored procedure with Nvarchar(max) parameter?

我们两清 提交于 2019-12-18 08:35:27
问题 Is it possible to create CLR stored procedure in SQL Server CLR project having input parameterof type nvarchar(max)? If you define stored procedure: <Microsoft.SqlServer.Server.SqlProcedure()> _ Public Shared Sub MyProcedure(ByVal param1 As String) Then when you deploy it, param1 is of type NVarchar(4000). Is there a way to have it NVarchar(max)? 回答1: Define your parameter to be of type SqlChars, instead of string. See Handling Large Object Parameters in the CLR 回答2: You can use the SqlFacet

The type or namespace name 'DataSetExtensions' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)

一个人想着一个人 提交于 2019-12-18 08:10:07
问题 I know this is a common error but I have the correct reference to the System.Data.DataSetExtensions.dll added to the project and my project is a SQL CLR project built for .net 4.5 and I'm getting the error at the following line: using System.Data.DataSetExtensions; I also checked the properties for the dll and it is referencing the correct version for the 4.5 dll so what else could possibly be causing this issue? Is this an issue with SQL CLR projects? 回答1: System.Data.DataSetExtensions is an

SQL Server: “CREATE ASSEMBLY for assembly 'Test' failed because assembly 'Test' is malformed or not a pure .NET assembly.”

人走茶凉 提交于 2019-12-18 06:58:05
问题 I get this error when I attempt to load a mixed mode C++/CLI assembly into SQL Server 2012: CREATE ASSEMBLY [Test] AUTHORIZATION [dbo] from 'H:\test.dll' WITH PERMISSION_SET = SAFE Msg 6544, Level 16, State 1, Line 1 CREATE ASSEMBLY for assembly 'Test' failed because assembly 'Test.dll' is malformed or not a pure .NET assembly. Unverifiable PE Header/native stub. 回答1: Mixed-mode Assemblies are not allowed in SQLCLR Assemblies; only pure MSIL Assemblies are allowed. This is implied in the MSDN