TechNet
Export (0) Print
Expand All

Built-in Functions (Transact-SQL)

 

 THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse yesParallel Data Warehouse

SQL Server provides many built-in functions and also lets you create user-defined functions. The categories of built-in functions are listed on this page.

FunctionDescription
Rowset FunctionsReturn an object that can be used like table references in an SQL statement.
Aggregate FunctionsOperate on a collection of values but return a single, summarizing value.
Ranking FunctionsReturn a ranking value for each row in a partition.
Scalar Functions (Described below)Operate on a single value and then return a single value. Scalar functions can be used wherever an expression is valid.
Function categoryDescription
Configuration FunctionsReturn information about the current configuration.
Conversion FunctionsSupport data type casting and converting.
Cursor FunctionsReturn information about cursors.
Date and Time Data Types and FunctionsPerform operations on a date and time input values and return string, numeric, or date and time values.
JSON FunctionsValidate, query, or change JSON data.
Logical FunctionsPerform logical operations.
Mathematical FunctionsPerform calculations based on input values provided as parameters to the functions, and return numeric values.
Metadata FunctionsReturn information about the database and database objects.
Security FunctionsReturn information about users and roles.
String FunctionsPerform operations on a string (char or varchar) input value and return a string or numeric value.
System FunctionsPerform operations and return information about values, objects, and settings in an instance of SQL Server.
System Statistical FunctionsReturn statistical information about the system.
Text and Image FunctionsPerform operations on text or image input values or columns, and return information about the value.

SQL Server built-in functions are either deterministic or nondeterministic. Functions are deterministic when they always return the same result any time they are called by using a specific set of input values. Functions are nondeterministic when they could return different results every time they are called, even with the same specific set of input values. For more information, see Deterministic and Nondeterministic Functions

Functions that take a character string input and return a character string output use the collation of the input string for the output.

Functions that take non-character inputs and return a character string use the default collation of the current database for the output.

Functions that take multiple character string inputs and return a character string use the rules of collation precedence to set the collation of the output string. For more information, see Collation Precedence (Transact-SQL).

CREATE FUNCTION (Transact-SQL)
Deterministic and Nondeterministic Functions
Using Stored Procedures (MDX)

Community Additions

ADD
Show:
© 2016 Microsoft