Using Operators in Expressions

Operators allow you to perform arithmetic, comparison, concatenation, or assignment of values. For example, you can test data to see if the country column for your customer data is populated (or not NULL).

In queries, anyone who can see the data in the table that needs to be used with some type of operator can perform operations. You need the appropriate permissions before you can successfully change the data.

Operators are used in Microsoft® SQL Server™ to:

SQL Server has seven categories of operators.

To perform this type of operation Use this operator category
Compare a value against another value or an expression. Comparison operators
Test for the truth of a condition, such as AND, OR, NOT, LIKE, ANY, ALL, IN. Logical
Addition, subtraction, multiplication, division, modulo Arithmetic operators
Performs on operation on one operand, such as positive or negative or one's complement. Unary
Temporarily turn regular numeric values (like 150) into an integer and perform bitwise (0 and 1) arithmetic Bitwise Operators
Either permanently or temporarily combine two strings (either character or binary data) into one string. String Concatenation Operator
Assigns a value to an variable, or associates a result set column with an alias. Assignment

An expression can be built from several smaller expressions combined by operators. In these complex expressions, the operators are evaluated in order based on the SQL Server definition of operator precedence. Operators with higher precedence are performed before operators with lower precedence. For more information, see Operators.

      


    (c) 1988-98 Microsoft Corporation. All Rights Reserved.