Parameter Sniffing (or Spoofing) in SQL Server
FYI – you need to be aware of something else when you’re working with SQL 2005 and stored procs with parameters. SQL Server will compile the stored proc’s execution plan with the first parameter that’s used. So if you run this: usp_QueryMyDataByState ‘Rhode Island’ The execution plan will work best with a small state’s data. … Read more