A scalar function takes a list of scalar arguments and return a
single scalar value.
- In the left pane of the Administration Console, expand , then select Scalar Functions.
- Click the drop-down arrow and select New.
- On the Introduction screen, select the server, database, and owner of the new function.
- Enter the name of the function.
- Select the datatype of the value returned by the function.
- On the Compilation Option screen, you can elect to have your function recompiled every time it is executed. This is useful if you expect parameter values to change frequently. If you do not select this option, the function is compiled only the first time it is executed.
- On the SQL Editor screen, provide the SQL statements for the scalar function. Ensure that all objects referenced by the function exist in the database.
- (Optional) Click Preview to see the SQL statements for your command.
- (Optional) Click Summary to verify your selected options.