I have some C# code (SQLCLR) which is reading an XML file from the local machine into a stream and returning it to SQL as SQLXML:
C# code
Stream str = File.OpenRead(xmlFilePath);
sqlXMLToReturn = new SqlXml(str);
SQL CLR Call from SQL Server 2014:
DECLARE @ResultForPos xml
EXEC @ResultForPos = spGetXmlForFile
SELECT @ResultForPos
My breakpoints in C# code gets hit when I debug the above SQL Script from SQL Server Object explorer inside Visual Studio 2015. There are no exceptions raised in C# code. However after running the script I get the following error in SQL Server.
Msg 206, Level 16, State 2, Procedure spWcfCall, Line 43
Operand type clash: int is incompatible with xml
What am I doing wrong? Do I have to do sqlXMLToReturn.Value and return a string instead of SQLXML.