Stored Procedures:
Stored procedures are extremely similar to the constructs seen in other programming languages.
They accept data in the form of input parameters that are specified at execution time.
Benifits of Stored Procedures:
1. PreComplied execution
2. Efficient reuse
3. Enhanced security controls
Example:
CREATE PROCEDURE sp_GetQuantity
@Name varchar(10)
AS
SELECT Product, Quantity
FROM Product_Table
WHERE Product = @Name
For executing the above Procedure:
EXECUTE sp_GetQuantity 'A7'
No comments:
Post a Comment