Stored procedures are special objects available in sql server. Its a precompiled statements where all the preliminary parsing operations are performed and the statements are ready for execution. Its very fast when compared to ordinary sql statements where the sql statements will undergone a sequence of steps to fetch the data Stored procedure involves various syntax based on the parameters passed. Let me show you a generic syntax for a stored procedure.
Benefits of Stored
Procedures
Precompiled execution.
SQL Server compiles each stored procedure once and then reutilizes the
execution plan. This results in tremendous performance boosts when stored
procedures are called repeatedly.
Reduced client/server
traffic. If network bandwidth is a concern in your environment, you'll be
happy to learn that stored procedures can reduce long SQL queries to
a single line that is transmitted over the wire.
Efficient reuse of
code and programming abstraction. Stored procedures can be used by multiple
users and client programs. If you utilize them in a planned manner, you'll find
the development cycle takes less time.
Enhanced security
controls. You can grant users permission to execute a stored procedure
independently of underlying table permissions.
Stored procedures are very similar to user-defined functions, but there are
subtle differences
No comments:
Write comments