我試圖在SQL Server 2008 R2中創建CLR集成函數,它將讀取Image/Varbinary
值並返回NVARCHAR(MAX)
。CLR集成函數將把圖像/變量值作爲輸入
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString ConvertByteArrToString(SqlBinary arrByte)
和SQL Server -
create function ReadAsString(@varData varbinary(max))
returns nvarchar(max)
as
external name CLRFunctions.[CLRFunctions.FormatUtilities].ConvertByteArrToString
但是,當我嘗試創建上面的函數,我得到這個錯誤:
Msg 6552, Level 16, State 3, Procedure ReadAsString, Line 1
ALTER FUNCTION for "ReadAsString" failed because T-SQL and CLR types for parameter "@varData" do not match.
有人建議應該是什麼正確的CLR匹配SQL Server Image/Varbinary(MAX)
?
http://stackoverflow.com/a/4764583/73226 –
謝謝馬丁!有效.. – user3927354