SEARCH ARGUMENTS v7.0 When writing SQL queries, it is important to realize what constitutes a good search argument. Knowing the difference can mean either a well- performing query or a poorly performing query. The placement of arguments within the WHERE clause can influence the efficiency of a query. Search arguments are usually variables of a known quantity and are specified in the WHERE clause of a SQL query. SELECT * FROM TableX WHERE Amount = 876 or DECLARE @Amt int SET @Amt = 1234 SELECT * FROM TableX WHERE Amount = @Amt The constant value 1234 and the @Amt variable are valid search arguments. These values are known at runtime when SQL Server executes the query. SELECT * FROM TableX WHERE Amount * 2 = 876 or DECLARE @Amt int SET @Amt = 1234 SELECT * FROM TableX WHERE Amount * 2 = @Amt The constant value 876 and the @Amt variable are good search arguments but notice the Amount * 2 on the left side of the equal sign. This is a valid query but, since the SQL optimizer does not know the value at runtime, SQL Server may need to scan the table in order to fulfill this query. As we know, table scans, by most accounts, are considered inefficient. The idea is to keep good search arguments on the right side of the operator (=, <, >=, etc) and avoid using calculations and functions on the left side of the operator. Using this method should have results returned faster to the user. ------------------------------------------