Microsoft Docs

Transact-SQL Functions

This section provides detailed information about the built-in functions available in Transact-SQL (T-SQL) for Microsoft SQL Server.

Aggregate Functions

AVG()

Calculates the average value of an expression.

View details...

COUNT()

Counts the number of rows or non-NULL values in an expression.

View details...

MAX()

Returns the maximum value in a set of expressions.

View details...

MIN()

Returns the minimum value in a set of expressions.

View details...

SUM()

Calculates the sum of values in an expression.

View details...

Scalar Functions

CAST() / CONVERT()

Converts an expression from one data type to another.

View details...

GETDATE()

Returns the current database system date and time.

View details...

LEN() / DATALENGTH()

Returns the length of a string or the number of bytes in an expression.

View details...

SUBSTRING()

Returns a part of a character string.

View details...

UPPER() / LOWER()

Returns the given string in uppercase or lowercase.

View details...

ISNULL()

Replaces NULL with a specified replacement value.

View details...

Table-Valued Functions

OPENJSON()

Parses JSON text and returns objects and properties as a rowset.

View details...

EOMONTH()

Returns the last day of the month that contains the specified date.

View details...

System Functions

DB_NAME()

Returns the name of the specified database.

View details...

USER_NAME()

Returns the user name associated with the specified user ID.

View details...