SQL Server Built-in Functions

In SQL, a built-in function is a programming object that takes zero or more inputs and returns a value. A feature that is built into an application and can be used by end users. Built-in functions in SQL SELECT expressions help in calculating numbers, casting or converting data, changing the format of fields, and analyzing data.

The following is a list of Microsoft SQL Server built-in functions, some of which have been covered in previous posts and are linked to those posts, while the others will be covered in depth in future topics.

Please note that certain functions are repeatative, which means there are several examples.

Aggregate Functions:

Analytical Functions:

Configuration Functions:

Conversion Functions:

Data Type Functions:

Date Time Functions:

JSON Functions:

Mathematical Functions: 

Logical Functions:

Ranking Functions:

Security Functions:

  • CERTENCODED
  • PWDCOMPARE
  • CERTPRIVATEKEY
  • PWDENCRYPT
  • CURRENT_USER
  • SCHEMA_ID
  • DATABASE_PRINCIPAL_ID
  • SCHEMA_NAME
  • sys.fn_builtin_permissions
  • SESSION_USER
  • sys.fn_get_audit_file
  • SUSER_ID
  • sys.fn_my_permissions
  • SUSER_SID
  • HAS_PERMS_BY_NAME
  • SUSER_SNAME
  • IS_MEMBER
  • SYSTEM_USER
  • IS_ROLEMEMBER
  • SUSER_NAME
  • IS_SRVROLEMEMBER
  • USER_ID
  • LOGINPROPERTY
  • USER_NAME
  • ORIGINAL_LOGIN
  • PERMISSIONS

String Functions:

System Functions:

  • $PARTITION
  • ERROR_PROCEDURE
  • @@ERROR
  • ERROR_SEVERITY
  • @@IDENTITY
  • ERROR_STATE
  • @@PACK_RECEIVED
  • FORMATMESSAGE
  • @@ROWCOUNT
  • GET_FILESTREAM_TRANSACTION_CONTEXT
  • @@TRANCOUNT
  • GETANSINULL
  • BINARY_CHECKSUM
  • HOST_ID
  • CHECKSUM
  • HOST_NAME
  • COMPRESS
  • ISNULL
  • CONNECTIONPROPERTY
  • ISNUMERIC
  • CONTEXT_INFO
  • MIN_ACTIVE_ROWVERSION
  • CURRENT_REQUEST_ID
  • NEWID
  • CURRENT_TRANSACTION_ID
  • NEWSEQUENTIALID
  • DECOMPRESS
  • ROWCOUNT_BIG
  • ERROR_LINE
  • SESSION_CONTEXT
  • ERROR_MESSAGE
  • SESSION_ID
  • ERROR_NUMBER
  • XACT_STATE

Window Functions:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s