Online Documentation for SQL Manager for SQL server

Creating/editing UDF


Use the Function tab of UDF Editor to create/edit a user-defined function and specify its definition.

 

For your convenience the syntax highlight, code completion and a number of other features for efficient SQL editing are implemented. For details see Working with Query Data area and Using the context menu.

 

UDF Editor - Editing UDF definition

 

 

You can also work on the UDF's definition with the help of the AI Assistant: the context menu of the editor provides the AI Assistant submenu, which lets you have the text explained, checked, optimized or formatted, or add it to the context of your next request.

 

AI Assistant - Object editors submenu

 

Note: A UDF is a Transact-SQL or common language runtime (CLR) routine that returns a value. User-defined functions, like system functions, can be invoked from a query. Scalar functions can be executed by using an EXECUTE statement like stored procedures.

 

To execute a UDF, you can use the btnExecuteQuery Execute item available within the Navigation bar.

 

If an error occurs while the UDF is being executed, the context menu of the message area at the bottom of the editor provides the AI: Fix error item: the AI Assistant receives the error text together with the statement that caused it and suggests a fix.

 

AI Assistant - Commands - Fix error