0
我是新來的,這是我的第一個問題。SQL CLR功能表輸入和輸出
我創建了一個DLL在VB中以使用它在SQL Server 2008 R2開發
下面的例子是功能,如果我刪除表輸入(和使用XML),但我需要有一個表格輸入。
--VB--
[SqlFunction(DataAccess:=DataAccessKind.Read, FillRowMethodName:="FillRow", TableDefinition:="ID int, Text nvarchar(max)")]
Public Shared Function MyFunction(ByVal tbl As IEnumerable(Of InputRow)) As IEnumerable
...
End Function
Public Shared Sub FillRow(...)
...
End Sub
Public Class InputRow
Public sID As SqlInt32
Public sText As SqlString
End Class
--SQL--
Create ASSEMBLY [ASSEMBLY1] from '[PATH].dll'
WITH PERMISSION_SET = unsafe
CREATE ASSEMBLY [ASSEMBLY2] from '[PATH].XmlSerializers.dll'
WITH PERMISSION_SET = unsafe
CREATE TYPE TableInput AS TABLE
(ID int, MyText varchar(1024))
CREATE FUNCTION ufn
(@sInputTable TableInput READONLY)
RETURNS TABLE (
anID int null,
SomeText nvarchar(max) null)
WITH EXECUTE AS CALLER
AS EXTERNAL NAME MyDotNETAssembly.[MyNamespace.MyClassname].MyFunction
錯誤: 消息6552,級別16,狀態3,過程UFN,2號線 CREATE FUNCTION爲「 ufn「失敗,因爲參數」@sInputTable「的T-SQL和CLR類型不匹配。
誰能幫助? 如何在SQL中「分配」輸入參數?