Q8.8: Why should I use stored procedures?
There are many advantages to using stored procedures (unfortunately
they do not handle the text/image types):
- Security - you can revoke access to the base tables and only
allow users to access and manipulate the data via the stored
procedures.
- Performance - stored procedures are parsed and a query plan is
compiled. This information is stored in the system tables and
it only has to be done once.
- Network - if you have users who are on a WAN (slow connection)
having stored procedues will improve throughput because less
bytes need to flow down the wire from the client to the SQL
server.
- Tuning - if you have all your SQL code housed in the database,
then it's easy to tune the stored procedure without affecting
the clients (unless of course the parameters change).
- Modularity - during application development, the application
designer can concentrate on the front-end and the DB designer
can concentrate on the SQL Server.