How to Fix the Error “Could not find the Database Engine startup

SQL Server NOT

Server / December 18, 2015

This SQL Server tutorial explains how to use the NOT condition in SQL Server (Transact-SQL) with syntax and examples.

Description

The SQL Server (Transact-SQL) NOT condition, also called the NOT Operator, is used to negate a condition in a SELECT, INSERT, UPDATE, or DELETE statement.

Syntax

The syntax for the NOT condition in SQL Server (Transact-SQL) is:

NOT condition

Parameters or Arguments

condition The condition to negate.

Note

  • The SQL Server NOT condition requires that the opposite of the condition be must be met for the record to be included in the result set.

Example - Combine With IN condition

For example:

SELECT * FROM employees WHERE first_name NOT IN ( 'John', 'Dale', 'Susan' );

This SQL Server NOT example would return all rows from the employees table where the first_name is not 'John', 'Dale', or 'Susan'. Sometimes, it is more efficient to list the values that you do not want, as opposed to the values that you do want.

Example - Combine With IS NULL condition

For example,

SELECT * FROM employees WHERE last_name IS NOT NULL;

This SQL Server NOT example would return all records from the employees table where the last_name does not contain a NULL value.

Example - Combine With LIKE condition

SELECT employee_id, last_name, first_name FROM employees WHERE last_name NOT LIKE 'A%';

By placing the SQL Server NOT Operator in front of the LIKE condition, you are able to retrieve all employees whose last_name does not start with 'A'.

Example - Combine With BETWEEN condition

SELECT * FROM employees WHERE employee_id NOT BETWEEN 200 AND 250;

This SQL Server NOT example would return all rows from the employees table where the employee_id was not between 200 and 250, inclusive. It would be equivalent to the following SQL Server SELECT statement:

SELECT * FROM employees WHERE employee_id < 200 OR employee_id > 250;

Example - Combine With EXISTS condition

SELECT * FROM employees WHERE NOT EXISTS (SELECT * FROM contacts WHERE employees.last_name = contacts.last_name AND employees.first_name = contacts.first_name);

This SQL Server NOT example would return all records from the employees table where there are no records in the contacts table for the matching last_name and first_name.

Source: www.techonthenet.com