Variables and functions are often used interchangeably. SQL Server Books Online documents some variables as if they were functions. However it's important to note that variables return a value whereas functions process specific business logic and many functions accept input arguments. Optional arguments are denoted using square brackets.
The system-supplied global variables are organized into these categories:
The system functions are organized into these categories: