Posts Tagged ‘IN Operator’

A quick example of why IN can be bad

Here’s just a quick demo that illustrates why the IN operator in TSQL might not perform as well as alternatives (like a range query or joining onto a temporary table containing your values). ?View Code TSQLIF OBJECT_ID(’tempdb..#temp’) IS NOT NULL BEGIN DROP TABLE #temp; END;   CREATE TABLE #temp ( id INTEGER NOT NULL IDENTITY(1,1), […]