Table-valued Function Designer

Table-valued Function Designer is a visual tool for creating, editing, and generating scripts for table-valued functions.

A table-valued function is a user-defined function that returns a table. You can use table-valued functions in queries like regular tables and pass parameters to filter or shape the returned data.

Open Table-valued Function Designer

You can open Table-valued Function Designer in one of these ways:

  • In Database Explorer, expand Programmability > Functions, right-click the Table-valued Functions node or a table-valued function, then select New Table-valued Function.
  • On the menu bar, select Database > New Database Object. Then select Table-valued function, enter the function name, and click Create.
  • On the Start Page, select Database Design > New Database Object. Then select Table-valued function, enter the function name, and click Create.

The Designer opens, displaying:

  • SQL Editor – Shows the CREATE FUNCTION template.
  • Bottom panel – Lets you refresh the object, apply changes, or generate a script for review before execution.

Table-valued Function Designer

You can also open Table-valued Function Designer for an existing table-valued function:

  • In Database Explorer, expand Programmability > Functions, right-click the required table-valued function, then select Open Editor. The CREATE FUNCTION definition opens, which you can use to change the code or rename the function.

SQL Editor

You can use SQL Editor to create and edit the table-valued function script.

CREATE FUNCTION dbo.function1 ()
RETURNS TABLE (
  
)
GO

The default function name is function1. If a function with this name already exists, dbForge Studio assigns the next available name, such as function2, function3, and so on. To use a different name, enter it in the template.

SQL Editor supports IntelliSense-style suggestions, quick object information, and parameter information, which you can use for writing and editing scripts.

Bottom panel

You can use the bottom panel to:

  • Refresh Object (Shift+Alt+R) – Reloads the object from the database.
  • Apply Changes (Shift+Alt+A) – Runs a SQL script and saves the changes to the database.
  • Script Changes – Generates the script in a new SQL document that includes all your changes without applying them to the database.

You can click the arrow next to Script Changes and select:

  • To New SQL Window (Shift+Alt+C) – Opens the script in a new SQL document.
  • To Clipboard – Copies the script to the clipboard.

Script Changes options