dimanche 12 avril 2015

CL Integration function that will take an Image/Varbinary value as input

I am trying to create a CLR Integration function (SQL Server 2008 R2) which will read a Image/Varbinary value and return a NVARCHAR(MAX).



[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString ConvertByteArrToString(SqlBinary arrByte)


And in SQL Server -



create function ReadAsString(@varData varbinary(max))
returns nvarchar(max)
as
external name CLRFunctions.[CLRFunctions.FormatUtilities].ConvertByteArrToString


But, when I try to create above funtion - I get below error.



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.


Can someone suggest what should be the correct CLR match for SQL=Server Image/Varbinary(MAX).


Aucun commentaire:

Enregistrer un commentaire