February 18, 2009 at 5:41 am
Hi All,
We have a requirement to work on SQL CLR Tabled Valued Funtion.
We found some code in the net
http://www.developer.com/db/article.php/3548331
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction(
FillRowMethodName="RowFiller",
TableDefinition="Divisor int")]
public static IEnumerable Divisor(Int32 input)
{
if (input < 1)
{
throw new ArgumentOutOfRangeException("input",
"Please pass in a value greater than 0") ;
}
for (int i = 1; i < input; i++)
{
// Is i a perfect divisor of input?
if(input%i == 0)
{
yield return i ;
}
}
}
public static void RowFiller(object row,
out int Divisor)
{
Divisor = (int)row ;
}
}
Not able to understand
1)How the control is flowing..?
2)How the "RowFiller" method is getting called
3)How the data get populated in the "TableDefinition="Divisor int""
Could you plz explain how SQL CLR Table valued funtion works.
Regards,
Sriram Satish
Viewing post 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply