SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for ASP.Net, SQL Server, Reporting Services, T-SQL, Windows, AWS, SAP HANA and ABAP


SQL Server 2005 Msg 6505 Could not find Type in assembly


If you can register a CLR (Common Language Runtime) assembly successfully but can not create an external stored procedure referencing the registered CLR assembly and getting the following SQL Server 2005 error message:

Msg 6505, Level 16, State 1, Procedure myProcedure, Line 2
Could not find Type 'myCLRMethods' in assembly 'myCLRAssembly'.

You can solve your problem by using the class name of your assembly in the format [NamespaceName.ClassName]

Sample: We can use master database

use master
go
Code

Then create the assembly in SQL Server 2005

Create assembly myCLRAssembly
from 'C:\WhidbeyProjects\myCLRAssembly\myCLRAssembly\bin\myCLRAssembly.dll'
Code




At this point if you browse the Sys.Assemblies table you can see the CLR Assebly record created in Sys.Assemblies table.

Select * from Sys.Assemblies
Code

Now, you can create the External Stored Procedure by running the below sql script.

Create Procedure myProcedure
as External Name myCLRAssembly.myCLRMethods.GetLuckyOne
Code

The above statement may cause the following SQL Server 2005 error message

Msg 6505, Level 16, State 1, Procedure myProcedure, Line 2
Could not find Type 'myCLRMethods' in assembly 'myCLRAssembly'.

If you modify the Create Procedure sql statement as shown below, you will succeed in creating the procedure

Create Procedure myProcedure
as External Name myCLRAssembly.[myCLRAssembly.myCLRMethods].GetLuckyOne
Code

Then you can execute your procedure by running

Exec myProcedure
Code


SQL Server

SQL Server 2019 Installation
download SQL Server 2019
download SQL Server 2017
download SQL Server 2016
download SQL Server 2014
download SQL Server 2012
MacOS ve SQL Server 2019


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.