Databases Reference
In-Depth Information
Figure 8-10
Sample database information.
SQL Server documentation tells you how to run the procedure and the infor-
mation it returns. You can see the results. However, you have no idea what SQL
Server went through to collect that information. Users will run procedures you
create the same way. They'll know the parameters required and what (if any-
thing) it returns, but not the details of how the result is accomplished. This lets
you hide the details of the database and database objects.
Designing Procedures
Most DBMSs let you create custom procedures, sometimes referred to as user
stored procedures. Procedures let you automate periodic or complex activities
and ensure that operations are run consistently. It doesn't take long to find sev-
eral candidates for procedures. In addition, because of how they are compiled
and run, procedures are more efficient than running ad hoc queries that perform
the same operations. The need for user intervention is reduced and direct access
to database tables is avoided.
One common use of procedures is data entry. Rather than having the user
(or application) run an INSERT command to enter data rows, you create a proce-
dure that runs INSERT for you, passing the column values as input parameters.
Search WWH ::




Custom Search