using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

public partial class UserDefinedFunctions
{
    [Microsoft.SqlServer.Server.SqlFunction]
    public static SqlInt32 Calculate(SqlInt32 passes, SqlInt32 repeat, SqlInt32 seed)
    {
        Int32 sum = 0;
        int r = repeat.Value;
        while (r-- > 0)
        {
            for (Int32 index = 0; index < passes.Value; index++)
            {
                sum = sum + seed.Value;
            }
           
        }
        return sum;
    }

    [Microsoft.SqlServer.Server.SqlFunction]
    public static SqlInt32 CalculateNothing(SqlInt32 passes, SqlInt32 repeat, SqlInt32 seed)
    {
        return 0;
    }

};

