示例#1
0
 private string GetFunctionTypeName(UserDefinedFunctionType type)
 {
     return(type switch
     {
         UserDefinedFunctionType.Inline => "Inline_Table_Function",
         UserDefinedFunctionType.Scalar => "Scalar_Function",
         UserDefinedFunctionType.Table => "Multiline_Table_Function",
         UserDefinedFunctionType.Unknown => "Unknown_Function",
         _ => "Unknown_Function"
     });
示例#2
0
        public void CreateUdfFunction(string name, UserDefinedFunctionType functionType, DataType dataType, string body, params DbParameter[] parameters)
        {
            var function = new UserDefinedFunction(SmoDatabase, name);

            function.TextMode      = false;
            function.IsSchemaBound = true;
            function.FunctionType  = functionType;
            foreach (var parameter in parameters)
            {
                var fParameter = new UserDefinedFunctionParameter(function, parameter.Name, parameter.DataType);
                function.Parameters.Add(fParameter);
            }
            function.DataType = dataType;

            function.TextBody = body;
            function.Create();
        }
 public UserDefinedFunctionWithType(UserDefinedFunction function, UserDefinedFunctionType type)
 {
     UserDefinedFunctionType = type;
     Function = function;
 }