Definition:
the stored procedure (Stored Procedure) is a large Database System , a set of SQL statements to complete a particular function, compiled and stored in a database, is executed by the user by specifying the name of the stored procedure and giving the parameter (if the stored procedure has parameters). Stored procedures are an important object in a database, and any well-designed database application should use stored procedures.
Advantages:
? ?
(1) Fast execution speed?
Stored procedure creation is done with syntax checking and performance optimizations that do not need to be compiled every time.
Storage on the database server, high performance.
? ?
(2) Allow modular design??
? you simply create a stored procedure once and store it in a database, and you can call the procedure any time in a program. Stored procedures can be created by people with expertise in database programming and can be individually modified independently of the program source code . ?
? ?
(3) Improve system security??
A stored procedure can be used as a conduit for user access to data. You can restrict user access to data tables, establish specific stored procedures for users to use, and complete access to data.
The definition text for a stored procedure can be encrypted so that the user cannot view its contents.
? ?
(4) Reduce network traffic?
??? an operation that requires hundreds of lines of Transact-SQL code is implemented by a separate statement that executes the procedure code without the need to send hundreds of lines of code across the network. ?????
Category:
by parameter: without parameters, with parameters (with input parameters, with output parameters, with input and output parameters)
? by implementation: Custom stored procedures, system stored procedures
?
Common system stored procedures (SQL Server):