SQL - Structured Query Language

IN Operator

IN operator is used to find out collection of records from group of records. The following query is used to find out Employee 101, 102 and 103 from EMP Table.

-- Example 45 --




SELECT * FROM EMP WHERE Emp_Code IN(101,102,103)

Query Output Screen

Note: Try to avoid extremely large number of values in an IN clause that consume resources and return run time error 8623 or 8632.

Error 8623

The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

Error 8632

Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.

* * * * *

Email Your Comment To AUTHOR