Supported Microsoft SQL Server and Microsoft Azure SQL Database Built-in Functions
A complete list of supported built-in functions for Microsoft SQL Server and Microsoft Azure SQL Database is available in the SYSADMIN.SourceSupportedSystemFunctions system table.
To retrieve the list, use the following query:
SELECT * FROM SYSADMIN.SourceSupportedSystemFunctions WHERE translator = 'sqlserver';;
Version Support
We support versions 14, 15, and 16 of Microsoft SQL Server.
Accordingly, refer to these versions when working with Microsoft SQL Server.Microsoft Azure SQL Database uses the same database engine as Microsoft SQL Server, but follows a managed "evergreen" versioning model.
Version 12 reflects the capabilities and compatibility level used in Azure environments.
Therefore, for Azure SQL Database, refer to version 12.
If a built-in function is not listed, it can be registered manually as a foreign function.
For instructions, see the “Built-in Functions” section on the Foreign Functions page.
List of Supported Functions
Function name | Supported in | Description | |||
Azure | v14 | v15 | v16 | ||
| Returns the number of attempted connections - both successful and unsuccessful - since SQL Server was last started | ||||
| Returns the amount of time that SQL Server has spent in active operation since its latest start | ||||
| Returns the number of qualifying rows currently in the last cursor opened on the connection | ||||
| Returns the value of the current timestamp data type for the current database. The current database will have a guaranteed unique timestamp value | ||||
| Returns the error number for the last Transact-SQL statement executed | ||||
| Returns the status of the last cursor | ||||
| Returns the last-inserted identity value | ||||
| Returns the time that SQL Server has been idle since it was last started | ||||
| Returns the time that SQL Server has spent performing input and output operations since SQL Server was last started | ||||
| Returns the local language identifier (ID) of the language that is currently being used | ||||
| Returns the name of the language currently being used | ||||
| Returns the current lock time-out setting in milliseconds for the current session | ||||
| Returns the maximum number of simultaneous user connections allowed on an instance of SQL Server. The number returned is not necessarily the number currently configured | ||||
| Returns the precision level used by decimal and numeric data types as currently set in the server | ||||
| Returns the nesting level of the current stored procedure execution (initially | ||||
| Returns information about the current | ||||
| Returns the number of network packet errors that have occurred on SQL Server connections since SQL Server was last started | ||||
| Returns the number of input packets read from the network by SQL Server since it was last started | ||||
| Returns the number of output packets written to the network by SQL Server since it was last started | ||||
| Returns the object identifier (ID) of the current Transact-SQL module | ||||
| Returns the name of the remote SQL Server database server as it appears in the login record | ||||
| Returns the number of rows affected by the last statement. If the number of rows is more than 2 billion, use | ||||
| Returns the name of the local server that is running SQL Server | ||||
| Returns the name of the registry key under which SQL Server is running | ||||
| Returns the session ID of the current user process | ||||
| Returns the current value of the | ||||
| Returns the number of microseconds per tick | ||||
| Returns the number of disk write errors encountered by SQL Server since SQL Server last started | ||||
| Returns the number of disk reads, not cache reads, by SQL Server since SQL Server was last started | ||||
| Returns the number of disk writes by SQL Server since SQL Server was last started | ||||
| Returns the number of | ||||
| Returns system and build information for the current installation of SQL Server | ||||
| Returns the absolute (positive) value of the specified numeric expression | ||||
| Arccosine function returns the angle, in radians, whose cosine is the specified float expression | ||||
| Returns the lock mode held by the lock owner on a particular application resource | ||||
| Returns information as to whether or not a lock can be granted on a particular application resource, for a specified lock owner, without acquisition of the lock | ||||
| Returns an approximate interpolated value from the set of values in a group based on percentile value and sort specification | ||||
| Returns the value from the set of values in a group based on the provided percentile and sort specification | ||||
| Returns the application name for the current session, if the application sets that name value | ||||
| Returns the ASCII code value of the leftmost character of a character expression | ||||
| Arcsine function returns the angle, in radians, whose sine is the specified float expression | ||||
| Returns information about a property of an assembly | ||||
| Returns the property of an asymmetric key | ||||
| Returns the ID of an asymmetric key | ||||
| Arctangent function returns the angle, in radians, whose tangent is a specified float expression | ||||
| Returns the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x) | ||||
| Returns the average of the values in a group. Ignores null values | ||||
| Returns the binary checksum value computed over a row of a table or over a list of expressions | ||||
|
| Takes one parameter and returns the number of bits set to | |||
| Convert an expression of one data type to another | ||||
| Returns the smallest integer greater than, or equal to, the specified numeric expression | ||||
| Returns the public portion of a certificate in binary format | ||||
| Returns the private key of a certificate in binary format | ||||
| Returns the value of a specified certificate property | ||||
| Returns the ID value of a certificate | ||||
| Returns the single-byte character with the specified integer code, as defined by the character set and encoding of the default collation of the current database | ||||
| Searches for one character expression inside a second character expression, returning the starting position of the first expression if found | ||||
| Returns the checksum value computed over a table row, or over an expression list. Use | ||||
| Returns the checksum of the values in a group. | ||||
| Returns the item at the specified index from a list of values in SQL Server | ||||
| Returns the requested property of a specified collation | ||||
| Returns column or parameter information | ||||
| Returns a varbinary bit pattern indicating the inserted or updated columns of a table or view | ||||
| Returns the defined length of a column, in bytes | ||||
| Returns the name of a table column, based on the table identification number and column identification number values of that table column | ||||
| Compresses the input expression, using the Gzip algorithm. The function returns a byte array | ||||
| Returns a string resulting from the concatenation, or joining, of two or more string values in an end-to-end manner | ||||
| Returns a string resulting from the concatenation, or joining, of two or more string values in an end-to-end manner. It separates those concatenated string values with the delimiter specified in the first function argument | ||||
| For a request that comes in to the server, this function returns information about the connection properties of the unique connection which supports that request | ||||
| This function returns the context_info value either set for the current session or batch, or derived through use of the | ||||
| Returns the trigonometric cosine of the specified angle - measured in radians - in the specified expression | ||||
| Returns the trigonometric cotangent of the specified angle - in radians - in the specified float expression | ||||
| Returns the number of items found in a group | ||||
| Returns the number of items found in a group | ||||
| Returns a cryptographic, randomly-generated hexadecimal number with a length of a specified number of bytes, generated by the Crypto API (CAPI) | ||||
| Calculates the cumulative distribution of a value within a group of values | ||||
| Returns the ID of the current request within the current session | ||||
| Current date and time | ||||
|
|
| This function returns the name of the time zone observed by a server or an instance. For SQL Managed Instance, return value is based on the time zone of the instance itself assigned during instance creation, not the time zone of the underlying operating system | ||
|
|
| This function returns the ID of the time zone observed by a server or an instance. For Azure SQL Managed Instance, return value is based on the time zone of the instance itself assigned during instance creation, not the time zone of the underlying operating system | ||
| Returns the transaction ID of the current transaction in the current session | ||||
| Returns the name of the current user | ||||
| Shows whether or not a cursor declaration has returned a cursor and result set | ||||
| Returns the current setting of the specified database option or property | ||||
| Returns the ID number of a principal in the current database | ||||
| Returns the number of bytes used to represent any expression | ||||
| This function adds a number (a signed integer) to a datepart of an input date, and returns a modified date/time value. For example, you can use this function to find the date that is 7000 minutes from today: number = 7000, datepart = minute, date = today | ||||
| This function returns the count (as a signed integer value) of the specified datepart boundaries crossed between the specified startdate and enddate | ||||
| This function returns the count (as a signed big integer value) of the specified datepart boundaries crossed between the specified startdate and enddate | ||||
| This function returns a date value that maps to the specified year, month, and day values | ||||
| This function returns a character string representing the specified datepart of the specified date | ||||
| This function returns an integer representing the specified datepart of the specified date | ||||
| This function returns a datetime2 value for the specified date and time arguments. The returned value has a precision specified by the precision argument | ||||
| This function returns a datetime value for the specified date and time arguments | ||||
| Returns a datetimeoffset value for the specified date and time arguments. The returned value has a precision specified by the precision argument, and an offset as specified by the offset arguments | ||||
|
|
| The | ||
|
|
| This function returns the date-time value corresponding to the start of each date-time bucket from the timestamp defined by the origin parameter, or the default origin value of 1900-01-01 00:00:00.000 if the origin parameter isn't specified | ||
| This function returns an integer that represents the day (day of the month) of the specified date | ||||
| Returns the database identification (ID) number of a specified database | ||||
| Returns the name of a specified database | ||||
| Decompresses an input expression value, using the Gzip algorithm. | ||||
| Decrypts data with an asymmetric key | ||||
| Uses the private key of a certificate to decrypt encrypted data | ||||
| Uses a symmetric key to decrypt data | ||||
| Decrypts encrypted data - first decrypts a symmetric key with a separate asymmetric key, and then decrypts the encrypted data with the symmetric key extracted in the first "step" | ||||
| Decrypts data with a symmetric key. That symmetric key automatically decrypts with a certificate | ||||
| Decrypts data originally encrypted with a passphrase | ||||
| Returns the corresponding angle, in degrees, for an angle specified in radians | ||||
| returns the rank of each row within a result set partition, with no gaps in the ranking values | ||||
| Returns an integer value measuring the difference between the | ||||
| Returns the character representation (JSON) of the edge ID for a given object ID and graph ID | ||||
| Encrypts data with an asymmetric key | ||||
| Encrypts data with the public key of a certificate | ||||
| Encrypts data with a symmetric key | ||||
| Encrypt data with a passphrase using the | ||||
| This function returns the last day of the month containing a specified date, with an optional offset | ||||
| Returns the line number of occurrence of an error that caused the | ||||
| Returns the message text of the error that caused the | ||||
| Returns the error number of the error that caused the | ||||
| Returns the name of the stored procedure or trigger where an error occurs, if that error caused the | ||||
| Returns severity value of the error where an error occurs, if that error caused the | ||||
| Returns the state number of the error that caused the | ||||
|
| Returns information about server or database events | |||
| Returns the exponential value of the specified float expression | ||||
| Returns the filegroup property value for a specified name and filegroup value | ||||
| Returns the filegroup identification (ID) number for a specified filegroup name | ||||
| Returns the filegroup name for the specified filegroup identification (ID) number | ||||
| Returns the specified file name property value when a file name in the current database and a property name are specified | ||||
| Returns the specified extended file property value when a file name in the current database and a property name are specified | ||||
| For the given logical name for a component file of the current database, this function returns the file identification (ID) number | ||||
| Returns the file identification (ID) number for the specified logical name of a data, log, or full-text file of the current database | ||||
| Returns the logical file name for a given file identification (ID) number, in the context of the current database | ||||
| Returns the first value in an ordered set of values | ||||
| Returns the largest integer less than or equal to the specified numeric expression | ||||
| Returns a value formatted with the specified format and optional culture. Use the | ||||
| Constructs a message from an existing message in sys.messages or from a provided string | ||||
| Returns information about full-text catalog properties in SQL Server | ||||
| Returns information related to the properties of the Full-Text Engine | ||||
| Returns the default nullability for the database for this session | ||||
| Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running | ||||
| Returns the current database system timestamp as a datetime value. The database time zone offset is not included. This value represents the current UTC time (Coordinated Universal Time). This value is derived from the operating system of the computer on which the instance of SQL Server is running | ||||
| Takes two parameters and returns the bit in | ||||
| Returns a token that represents the current transaction context of a session. The token is used by an application to bind | ||||
| Returns the internal graph ID for a given edge ID | ||||
| Returns the internal graph ID for a given node ID | ||||
| This function returns the maximum value from a list of one or more expressions | ||||
| Indicates whether a specified column expression in a | ||||
| Computes the level of grouping for multiple columns | ||||
| Returns the MD2, MD4, MD5, SHA, SHA1, or SHA2 hash of its input | ||||
| Returns information about whether the user has access to the specified database | ||||
| Evaluates the effective permission of the current user on a securable | ||||
| Returns the workstation identification number. The workstation identification number is the process ID (PID) of the application on the client computer that is connecting to SQL Server | ||||
| Returns the workstation name | ||||
| Used only in a | ||||
| Returns the last identity value generated for a specified table or view. The last identity value generated can be for any session and any scope | ||||
| Returns the increment value specified when creating a table or view's identity column | ||||
| Returns the original seed value specified when creating an identity column in a table or a view | ||||
| Returns one of two values, depending on whether the Boolean expression evaluates to true or false | ||||
| Returns information about the index key | ||||
| Returns the named index or statistics property value of a specified table identification number, index or statistics name, and property name | ||||
| Returns the indexed column name | ||||
| Returns | ||||
| Tests whether a string contains valid JSON | ||||
| Replaces | ||||
| Determines whether an expression is a valid numeric type | ||||
| Indicates whether the current user is a member of the specified Microsoft Windows group, Microsoft Entra group, or SQL Server database role | ||||
| Indicates whether an object is signed by a specified certificate or asymmetric key | ||||
Indicates whether a specified database principal is a member of the specified database role | |||||
| Indicates whether a SQL Server login is a member of the specified server role | ||||
| Constructs JSON array text from zero or more expressions | ||||
| Updates the value of a property in a JSON string and returns the updated JSON string | ||||
| Constructs JSON object text from zero or more expressions | ||||
| Tests whether a specified SQL/JSON path exists in the input JSON string | ||||
| Extracts an object or an array from a JSON string | ||||
| Extracts a scalar value from a JSON string | ||||
| Returns the GUID of a symmetric key in the database | ||||
| Returns the ID of a symmetric key in the current database | ||||
| Returns the name of the symmetric key from either a symmetric key GUID or cipher text | ||||
| Accesses data from a previous row in the same result set without the use of a self-join in order to compare values in the current row with values in a previous row | ||||
| Returns the last value in an ordered set of values | ||||
| Accesses data from a subsequent row in the same result set without the use of a self-join in order to compare values in the current row with values in a following row | ||||
| This function returns the minimum value from a list of one or more expressions | ||||
| Returns the left part of a character string with the specified number of characters | ||||
| Takes two parameters, and returns the first parameter bit-shifted left by the number of bits specified in the second parameter | ||||
| Returns the number of characters of the specified string expression, excluding trailing spaces | ||||
| Returns the natural logarithm of the specified float expression | ||||
| Returns the base-10 logarithm of the specified float expression | ||||
| Returns information about login policy settings | ||||
| Returns a character expression after converting uppercase character data to lowercase | ||||
| Removes space character char(32) or other specified characters from the start of a string | ||||
| Returns the maximum value in the expression | ||||
| Returns the minimum value in the expression | ||||
| Returns the lowest active rowversion value in the current database. A rowversion value is active if it is used in a transaction that has not yet been committed | ||||
| Returns an integer that represents the month of the specified date | ||||
| Returns the Unicode character with the specified integer code, as defined by the Unicode standard | ||||
| Creates a unique value of type uniqueidentifier | ||||
| Creates a GUID that is greater than any GUID previously generated by this function on a specified computer since Windows was started | ||||
| Returns the character representation (JSON) of the node ID for a given object ID and graph ID | ||||
| Distributes the rows in an ordered partition into a specified number of groups. The groups are numbered, starting at one. For each row, | ||||
| Returns information about schema-scoped objects in the current database | ||||
| Returns information about schema-scoped objects in the current database | ||||
| Returns the Transact-SQL source text of the definition of a specified object | ||||
| Returns the database object identification number of a schema-scoped object | ||||
| Returns the object ID for a given graph edge ID | ||||
| Returns the object ID for a given graph node ID | ||||
| Returns the database object name for schema-scoped objects | ||||
| Returns the database schema name for schema-scoped objects | ||||
| Returns the database name specified by the user in the database connection string | ||||
| Returns the name of the login that connected to the instance of SQL Server | ||||
| Returns the result of an expression, translated to the requested data type | ||||
| Returns the specified part of an object name. The parts of an object that can be retrieved are the object name, schema name, database name, and server name | ||||
| Returns the starting position of the first occurrence of a pattern in a specified expression, or zero if the pattern is not found | ||||
| Calculates a percentile based on a continuous distribution of the column value | ||||
| Computes a specific percentile for sorted values in an entire rowset or within a rowsets distinct partitions | ||||
| Calculates the relative rank of a row within a group of rows | ||||
| Returns a value containing a bitmap that indicates the statement, object, or column permissions of the current user | ||||
| Returns the constant value of PI | ||||
| Returns the value of the specified expression to the specified power | ||||
| Returns the name of the originating Publisher for a published database participating in a database mirroring session | ||||
| Hashes a password and compares the hash to the hash of an existing password | ||||
| Returns the SQL Server password hash of the input value that uses the current version of the password hashing algorithm | ||||
| Returns a Unicode string with the delimiters added to make the input string a valid SQL Server delimited identifier | ||||
| Returns radians when a numeric expression, in degrees, is entered | ||||
| Returns a pseudo-random float value from 0 through 1, exclusive | ||||
| Returns the rank of each row within the partition of a result set | ||||
| Replaces all occurrences of a specified string value with another string value | ||||
| Repeats a string value a specified number of times | ||||
| Returns the reverse order of a string value | ||||
| Returns the right part of a character string with the specified number of characters | ||||
| Takes two parameters, and returns the first parameter bit-shifted right by the number of bits specified in the second parameter | ||||
| Returns a numeric value, rounded to the specified length or precision | ||||
| Returns the number of rows affected by the last statement executed. This function operates like | ||||
| Returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition | ||||
| Removes space character char(32) or other specified characters from the end of a string | ||||
| Returns the schema ID associated with a schema name | ||||
| Returns the schema name associated with a schema ID | ||||
| Returns property information about the server instance | ||||
| Returns the SET options settings of a session | ||||
| Returns the value of the specified key in the current session context. The value is set by using the | ||||
| Returns the user name of the current context in the current database | ||||
| Returns expression_value offset by the bit defined by | ||||
| Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression | ||||
| Signs plaintext with an asymmetric key | ||||
| Signs text with a certificate and returns the signature | ||||
| Returns the trigonometric sine of the specified angle, in radians | ||||
| Returns a smalldatetime value for the specified date and time | ||||
| Returns a four-character ( | ||||
| Returns a string of repeated spaces | ||||
| Returns the base data type and other information about a sql_variant value | ||||
| Returns the square root of the specified float value | ||||
| Returns the square of the specified float value | ||||
| Returns the date of the most recent update for statistics on a table or indexed view | ||||
| Returns the statistical standard deviation of all values in the specified expression | ||||
| Returns the statistical standard deviation for the population for all values in the specified expression | ||||
| Returns character data converted from numeric data. The character data is right-justified, with a specified length and decimal precision | ||||
| Concatenates the values of string expressions and places separator values between them. The separator isn't added at the end of string | ||||
| Escapes special characters in texts and returns text with escaped characters | ||||
| Inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position | ||||
| Returns part of a character, binary, text, or image expression in SQL Server | ||||
| Returns the sum of all the values, or only the | ||||
| Returns the login identification number of the user | ||||
| Returns the login identification name of the user | ||||
| Returns the security identification number (SID) for the specified login name | ||||
| Returns the login name associated with a security identification number (SID) | ||||
| Returns a datetimeoffset value that is changed from the stored time zone offset to a specified new time zone offset | ||||
| Returns the algorithm of a symmetric key created from an EKM module | ||||
| Returns a datetime2(7) value that contains the date and time of the computer on which the instance of SQL Server is running | ||||
| Returns a datetimeoffset(7) value that contains the date and time of the computer on which the instance of SQL Server is running. The time zone offset is included | ||||
| Allows a system-supplied value for the current login to be inserted into a table when no default value is specified | ||||
| Returns a datetime2 value that contains the date and time of the computer on which the instance of SQL Server is running. The date and time is returned as UTC time (Coordinated Universal Time). The fractional second precision specification has a range from 1 to 7 digits. The default precision is 7 digits | ||||
| Returns the tangent of the input expression | ||||
| For each character in a non-Unicode string expression - defined with a SQL tertiary collation - this function returns a binary string of weights | ||||
| Returns the text-pointer value that corresponds to a text, ntext, or image column in varbinary format. The retrieved text pointer value can be used in | ||||
| A text, ntext, or image function that checks whether a specific text pointer is valid | ||||
| Returns a time value for the specified time and with the specified precision | ||||
| Returns a datetimeoffset value that is translated from a datetime2 expression | ||||
| Returns the string provided as a first argument, after some characters specified in the second argument are translated into a destination set of characters, specified in the third argument | ||||
| Returns the number of triggers executed for the statement that fired the trigger | ||||
| Returns a value cast to the specified data type if the cast succeeds otherwise, returns | ||||
| Returns a value cast to the specified data type if the cast succeeds otherwise, returns | ||||
| Returns the result of an expression, translated to the requested data type, or null if the cast fails | ||||
| Returns information about a data type | ||||
| Returns the ID for a specified data type name | ||||
| Returns the unqualified type name of a specified type ID | ||||
| Returns the integer value, as defined by the Unicode standard, for the first character of the input expression | ||||
| Returns a Boolean value that indicates whether an | ||||
| Returns a character expression with lowercase character data converted to uppercase | ||||
| Allows a system-supplied value for the current login to be inserted into a table when no default value is specified | ||||
| Returns the identification number for a database user | ||||
| Returns a database user name from a specified identification number, or the current user name | ||||
| Returns the statistical variance of all values in the specified expression | ||||
| Returns the statistical variance for the population for all values in the specified expression | ||||
| Tests whether digitally signed data has been changed since it was signed | ||||
| Tests whether digitally signed data has been changed since it was signed | ||||
| Returns whether the request has an active user transaction, and whether the transaction is capable of being committed | ||||
| Returns an integer that represents the year of the specified date |