I just received the following question from a colleague:
___________________________________________________________
Student needs to retrieve a single record from a database (actually only a few fields). Is it faster to:
a. Use datareader
b. Use stored procedure with output parameters
processing about 1/2 million records, so he feels it's important. Besides devising a test, do any of you know, or know how to find out easily?
Thanks.
______________________________________________________________
My first instinct is that the SP would be a bit faster – since there is less processing of the actual SQL statement. I don’t use output parameters very often at all, but if the procedure returns more than 1 value, won’t you need to use a DataReader anyways to process the results? So does this question just become one of: Is it faster to use a Stored Procedure over a direct SQL query?