Functions Wizard (SQL Server)

From DBArtisan
Jump to: navigation, search

Go Up to Microsoft SQL Server Object Wizards

Functions are subroutines that you define so you can reuse code without having to reinvent the wheel each time. You can use functions to determine the best methods for controlling access and manipulation of the underlying data contained in an object. A function returns a value, unlike a stored procedure, which does not.

  • To create a user-defined function, you need CREATE ANY privileges or IMPLICIT_SCHEMA authority on the database if the schema does not already exist.

To create a new function using a wizard:

  1. Open a creation wizard for a function. For details, see Opening an Object Wizard.
  2. Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
  3. Finally, use the Execute button to create the object.

Functions (SQL Server) - Properties

When creating or editing a function, this tab/panel lets you work with the following settings:

Setting Description
Owner Select the owner of the function.
Name Provide a name for the function.
Schema Binding Choose whether the function is bound to database objects that it references.
Encryption Choose whether SQL Server encrypts table columns that contain the text of the CREATE FUNCTION statement.
Native Compilation This option sets natively-compiled functions that allow for efficient query execution within the stored procedure.

Functions (SQL Server) - Definition

Complete the CREATE FUNCTION outline provided by typing or pasting the body of the function.