我試圖在SQL Server 2008中調用我的第一個CLR存儲過程。我已成功編譯DLL並創建了程序集。現在,我想Create the stored procedure that references the registered assembly by using the CREATE PROCEDURE statement.繼this tutorial,我得到的語法錯誤......在創建CLR存儲過程時出現語法錯誤
--This line worked. Just including this code just to show what I am doing ...
--create assembly
--LevenshteinLibrary
--from 'Drive Letter:\Path\LevenshteinLibrary.dll'
create procedure testCLR(@s1 nvarchar(1000), @s2 nvarchar(1000))
as external LevenshteinLibrary.getLevenshteinDistance --Incorrect syntax near '.'.
我應該怎麼做來創建此過程?我沒有在msdn create procedure頁面上看到任何解釋「as external」正確語法的內容。
的VB.net代碼如下所示:
Imports System.Math
Imports System.Text.RegularExpressions
Imports Microsoft.SqlServer.Server
Partial Public Class LevenshteinerAndSoundexer
<SqlProcedure()> _
Public Shared Function getLevenshteinDistance(ByVal string1 As String, ByVal String2 As String) As Integer
鏈接到的文檔適用於沒有CLR過程的SQL 2000。 [2008文檔](http://msdn.microsoft.com/en-us/library/ms187926(v = sql.100).aspx)顯示正確的語法(這不是你現在所擁有的)。 – Pondlife