How to: Include User-Defined Functions in Queries
You can include a user-defined function in queries of Microsoft SQL Server databases. You can include any of the three types of functions:
Non-updatable functions returning a table.
Updatable functions returning a table.
Functions returning a scalar.
Note
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.
To include an updatable or non-updatable table function in a query or view
Design the query to which you want to add the function. In the Query and View Designer, be sure the Diagram pane is visible.
In Server Explorer, expand the Data Connections node and the particular node for the database you are working on.
Expand the Functions node.
From the list of functions, drag the function onto the Diagram pane.
To include a scalar function in a query or view
Design the query to which you want to add the function. In the Query and View Designer, be sure the Criteria pane is visible.
In Server Explorer, expand the Data Connections node and the particular node for the database you are working on.
Expand the Functions node.
In the first blank row of the Criteria pane, enter the name of the function in the Column column.