Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Performance regarding output variables versus select statements

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-02-16 : 07:28:42
scott writes "Hey - just a quick question, I did a little research on this, and have a gut feeling about what is more efficient - but I'd like to run it by you.

I'm wondering if using output variables in a stored procedure is more efficient than using a select statement to return data to the calling procedure. My gut feeling is that using output variables is more efficient.

I'm pretty sure that the performance hit is minimal considering SQL Server - but the impact to performance is probably greater in the calling application, considering that the caller will have to handle a recordset instead of a accessing the return parameters directly out of the command object.

Sorry to mix in application programming, but feel it is relevant, and maybe I should look more at ADO programming efficiency instead of from the SQL Server side.

Thanks - any info is appreciated.

Scott"

nr
SQLTeam MVY

12543 Posts

Posted - 2004-02-16 : 08:07:05
>> My gut feeling is that using output variables is more efficient.
yes.

For a recordset the server has to prepare a cursor and pass a load of info which has to be received (and discarded) by the client which will also have to create all the structures needed for recordset processing.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -