Builtin Functions

Binary string functions

DATALENGTH (Binary String) binary string length.
LEN (Binary String) binary string length.

String functions

ASCII returns the unicode code point of a character.
CHAR returns the unicode character specified by code point.
CHARINDEX returns position of a substring in a string.
CHARLEN *RSQL only* string length.
CONCAT concatenate strings, ignoring NULL values.
DATALENGTH string length.
FORMAT returns a localized string representation of a numeric or datetime value.
ISDATE returns 1 if string can be parsed as date, time, or datetime.
ISNUMERIC checks if expression is valid numeric value.
LEFT returns left part of a string.
LEN string length, excluding trailing blanks.
LOWER converts to lowercase.
LTRIM removes leading blanks.
NCHAR returns the unicode character specified by code point.
REPLACE replaces all occurrences of a substring with another string.
REPLICATE replicates a string n times.
RIGHT returns right part of a string.
RTRIM removes trailing blanks.
SPACE returns a string filled with spaces.
STR formats a float value.
STUFF replaces portion of a string by a substring.
SUBSTRING returns portion of a string.
TRIM removes leading and trailing blanks.
UNICODE returns the unicode code point of a character.
UPPER converts to uppercase.

Math functions

ABS absolute value
ACOS arccosine
ASIN arcsine
ATAN arctangent
ATN2 angular part of <x, y> coordinates
CEILING ceiling
COS cosine
COT cotangent
DEGREES degrees from radians
EXP exponential function
FLOOR floor
ISNUMERIC checks if expression is valid numeric value.
LOG natural logarithm
LOG10 base-10 logarithm
PI value of Pi
POWER power
RADIANS radians from degrees
RAND returns a random number.
ROUND rounds or truncates the number.
SIGN sign of the number
SIN sine
SQRT square root
SQUARE square
TAN tangent

Date functions

BOMONTH *RSQL only* first day of month for specified date.
CURRENT_TIMESTAMP local current datetime.
DATEADD returns date + specified duration.
DATEDIFF duration between two dates.
DATEFROMPARTS creates date from the specified parts.
DATENAME returns specified part of the date, as string.
DATEPART returns specified part of the date, as integer.
DATETIME2FROMPARTS creates datetime from the specified parts.
DATETIMEFROMPARTS creates datetime from the specified parts.
DAY day of the specified date.
EOMONTH last day of month for specified date.
GETDATE local current datetime.
GETUTCDATE UTC current datetime.
ISDATE returns 1 if string can be parsed as date, time, or datetime.
MONTH month of the specified date.
SYSDATETIME local current datetime.
SYSUTCDATETIME UTC current datetime.
TIMEFROMPARTS creates time from the specified parts.
YEAR year of the specified date.

Logical functions

CASE returns the first result in the list for which the condition is true.
CHOOSE returns argument at position i in the list.
COALESCE returns first non-NULL argument in the list.
IIF if expression is true, returns a. Else returns b.
ISNULL if argument is NULL, returns a replacement value.
NULLIF returns NULL if the two specified expressions are equal.

Conversion functions

CAST converts argument to specified datatype.
CONVERT converts argument to specified datatype.
FORMAT returns a localized string representation of a numeric or datetime value.
STR formats a float value.

Random functions

RANDOM_BIGINT *RSQL only* random bigint between two values.
RANDOM_DATE *RSQL only* random date between two dates.
RANDOM_FLOAT *RSQL only* random float between two values.
RANDOM_INT *RSQL only* random int between two values.
RANDOM_NUMERIC *RSQL only* random numeric value.
RANDOM_VARCHAR *RSQL only* random ascii string of length between specified limits.

Aggregation functions

AVG returns the average value of expressions.
COUNT returns the count of expressions.
COUNT_BIG returns the count of expressions.
MAX returns the maximum value.
MIN returns the minimum value.
SUM returns the sum of expressions.

System functions

@@DATEFIRST current DATEFIRST value
@@DATEFORMAT *RSQL only* current DATEFORMAT value
@@ERROR last statement error code. Is always 0.
@@IDENTITY last IDENTITY value inserted
@@LANGUAGE current language
@@ROWCOUNT number of records affected by the last statement
@@SERVERNAME machine/service name of the instance
@@SERVICENAME service name of the instance
@@TRANCOUNT transaction nesting level
@@VERSION RSQL version
CURRENT_USER current user name
DATABASE_PRINCIPAL_ID user or role ID
DB_ID database ID
DB_NAME database name
OBJECT_ID object ID
SCHEMA_ID schema ID
SCHEMA_NAME schema name
SCOPE_IDENTITY last IDENTITY value inserted.
SESSION_USER current user name
SUSER_ID login ID
SUSER_NAME login name
SYSTEM_USER current login name
TYPEOF *RSQL only* returns datatype of the argument as string.
USER current user name
USER_ID user or role ID
USER_NAME user or role name