Use the SQL Server Function Editor to define a function for a database or table in a SQL Server physical model.
To define a SQL Server function
The SQL Server Function Editor opens.
Note: Click New on the toolbar to create a new function. Use the Enter filter text box to filter a very large list of functions to quickly locate the one that you want to define.
Specifies the name of the function. Change the name of the function in this field.
Specifies the schema of the database to which the function belongs. Select the schema from the drop-down list.
Specifies whether the function type is model-level or table-level. Select the type from the drop-down list.
Specifies to enable the function in the database.
Specifies to attach the selected function to each new table that you create. Clear the check box if you want to manually attach the function to new tables.
Generates SQL during forward engineering. Clear the check box if you do not want to generate SQL.
Specifies whether the function is generated as part of a pre-script. Select an option from the drop-down list.
Specifies the type of function and its associated values. Select one of the following function types from the drop-down list:
Scalar Function
Specifies the scalar function type, which returns a single data value. When you select Scalar Function, you can use the Null Input, Return Data Type, Encryption, and Schema Binding options that populate the grid to further define the function.
Inline Table Function
Specifies the inline table-valued function type, which returns a result set of single SELECT statement. When you select Inline Table Function, you can use the Null Input, Encryption, and Schema Binding options that populate the grid to further define the function.
Multistatement Table Function
Specifies the multi-statement table-valued function type, which returns a result set in table form, which was built from multiple statements. When you select Multistatement Table Function, you can use the Null Input, Encryption, Schema Binding, Return Table Definition, and Return Variable options that populate the grid to further define the function.
Scalar Return Assembly Function
Specifies the scalar return assembly function type, which returns a single value by executing a method from an assembly. When you select Scalar Return Assembly Function, you can use the Null Input, Return Data Type, Assembly, Class Name, and Method Name options that populate the grid to further define the function.
Table Return Assembly Function
Specifies the table return assembly function type, which returns a table of values by executing a method from an assembly. When you select Table Return Assembly Function, you can use the Null Input, Return Table Definition, Assembly, Class Name, and Method Name options that populate the grid to further define the function. Use the Return Order tab to define the order in which results should be returned.
Natively Compiled Scalar Function
Specifies the natively compiled scalar function type, which are scalar user-defined functions. Natively compiled scalar functions are available SQL Server 2016 onward. When you select Natively Compiled Scalar Function, you can use the Null Input, Return Data Type, Transaction Isolation Level, Language, Date First, Date Format, and Delayed Durability options that populate the grid to further define the function.
Specifies the permission level in effect when the function is executed.
Specifies the user whose permissions are in effect for the execution of the function.
Note: This option is only available if you have selected the Execute As User option in the Type drop-down list.
Specifies the parameters for the function and lets you select the order in which the parameters execute and the properties of each one.
Note: Click New on the toolbar to add a new parameter.
The function is defined and the SQL Server Function Editor closes.
Copyright © 2017 erwin Inc.
All rights reserved.
|
|