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)
 stored procedure vs regular query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-09-04 : 11:44:38
Greg writes "Why should I use a stored procedure vs a regular query?

Is there a big enough speed increase between using stored procedures rather than a regular query to justify putting every last query into a stored procedure?

If all I am doing is "select UserID, FirstName, LastName from tblUsers" should I put that in a stored procedure?"

nr
SQLTeam MVY

12543 Posts

Posted - 2002-09-04 : 12:04:36
Speed is not the main concern it is security and maintainability.

If you change the database structure (new requirements, performance, ...)
then you just need to alter the stored procedures - no need to get involved in changing and testing applications.
If a query is taking too long or blocking something then it is easy to diagnose and restructure in the SP - much more difficult in an app.

If you have a probl;em with the system and get someone who knows sql server to have a look at it then it will be easy for him to look at the SPs and simulate what is happenning for testing different queries.

Stored procedures will be faster and lock less resources but in a well designed system that's usually not a problem.


==========================================
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 -