EXISTS
will be faster because once the engine has found a hit, it will quit looking as the condition has proved true.
With IN
, it will collect all the results from the sub-query before further processing.
More Related Contents:
- T-SQL: Opposite to string concatenation – how to split string into multiple records [duplicate]
- What is the best way to create and populate a numbers table?
- Sql Server string to date conversion
- SQL Server query to find all permissions/access for all users in a database
- Cannot truncate table because it is being referenced by a FOREIGN KEY constraint?
- What is the maximum characters for the NVARCHAR(MAX)? [duplicate]
- Do I really need to use “SET XACT_ABORT ON”?
- Creating audit triggers in SQL Server
- Query times out when executed from web, but super-fast when executed from SSMS
- Regular Expressions in SQL Server servers?
- How to determine total number of open/active connections in ms sql server 2005
- How to remove accents and all chars a..z in sql-server?
- Find non-ASCII characters in varchar columns using SQL Server
- How to query values from xml nodes?
- Diagnosing Deadlocks in SQL Server 2005
- How to query for Xml values and attributes from table in SQL Server?
- Disadvantages of MARS (Multiple Active Result Sets)?
- Violation of UNIQUE KEY constraint on INSERT WHERE COUNT(*) = 0 on SQL Server 2005
- sql use statement with variable
- SQL Server recursive query
- Milliseconds wrong when converting from XML to SQL Server datetime
- nvarchar(max) vs NText
- Cannot find either column “dbo” or the user-defined function or aggregate “dbo.Splitfn”, or the name is ambiguous
- Date range overlapping check constraint
- “Prevent saving changes that require the table to be re-created” negative effects
- Get row where datetime column = today
- Convert UTC Milliseconds to DATETIME in SQL server
- Table Valued Function Killing My Query Performance
- Full text catalog/index search for %book%
- @@ERROR and/or TRY – CATCH