SP is a set of SQL Statements that resides in server. Advantage of SP is just that it is pre compiled and available in the server. So, whenever this SP is called, its executed instantly since its already been compiled. This makes the faster performance while executing the SP.
We can also make the SP recompile when ever it is called by using
"With Recompile" keyword while creating the SP. So whenever the SP is called it is recompiled and then execute.
Cursors:
Cursors are add on feature of SP , for row by row validations.
For instance : You have a list of employees belong to various department. For calculating the bonus % which varies for department to department, you use cursors to calculate Bonus.
No comments:
Post a Comment