December 2013
Intermediate to advanced
1872 pages
153h 31m
English
You create T-SQL functions by using T-SQL statements. You can enter the T-SQL code in sqlcmd, SSMS, or any other third-party query tool that allows you to enter ad hoc T-SQL code. The following sections first show the basic syntax for creating functions and then show how you can create functions by using the features of SSMS.
User-defined functions can accept 0 to 2,100 input parameters but can return only a single result: either a single scalar value or table result set.
The T-SQL syntax for the CREATE FUNCTION command for scalar functions is as follows:
CREATE FUNCTION [ schema_name. ] function_name ( [ { @parameter_name [AS] [ schema_name.]scalar_datatype ...