How not specifying the ADO.NET SqlParameter DbType can lead to a horrible query execution plan! I was looking into a query that was performing much worse than expected. The query was a simple select of the form: select e.EmployeeID, count(r.EmployeeRoleID) from Employee e left join EmployeeRole r on e.EmployeeID = r.EmployeeID where e.EmployeeRef = @EmployeeRef group by e.EmployeeID I expected the query plan for this to be fairly straightforward, a couple of Index Seeks and a Left Outer Join, but ......