Combines two Boolean expressions and returns TRUE when both expressions are TRUE. When more than one logical operator is used in a statement, the AND operators are evaluated first. You can change the order of evaluation by using parentheses.
A. Using the AND operator
The following example selects information about employees who have both the title of Marketing Assistant and more than 41 vacation hours available.
USE AdventureWorks2012; GO SELECT BusinessEntityID, LoginID, JobTitle, VacationHours FROM HumanResources.Employee WHERE JobTitle = 'Marketing Assistant' AND VacationHours > 41 ;
B. Using the AND operator in an IF statement
The following examples show how to use AND in an IF statement. In the first statement, both 1 = 1 and 2 = 2 are true; therefore, the result is true. In the second example, the argument 2 = 17 is false; therefore, the result is false.
IF 1 = 1 AND 2 = 2 BEGIN PRINT 'First Example is TRUE' END ELSE PRINT 'First Example is FALSE'; GO IF 1 = 1 AND 2 = 17 BEGIN PRINT 'Second Example is TRUE' END ELSE PRINT 'Second Example is FALSE' ; GO