Answer the question
In order to leave comments, you need to log in
How do I get rid of previous results when calling a Table-Valued CLR Function?
I made a CLR assembly for MSSQL Server 2012, wrote a method that converts a string with a separator into an array of numbers:
[SqlFunction(FillRowMethodName = "FillRowCustomTable")]
public static IEnumerable Split(SqlChars value)
{
return value.eStr().Split(';').Select(x => int.Parse(x));
}
public static void FillRowCustomTable(object resultObj, out SqlInt32 ID)
{
ID = new SqlInt32((int)resultObj);
}
CREATE FUNCTION clr.Split(@Value NVARCHAR(MAX))
RETURNS TABLE(Value int) EXTERNAL NAME Regex.[SQLCLR.RegularExceptions].Split
SELECT * FROM clr.Split(@Val)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question