Do you have a set of tasks that are repeatedly performed in your programs?. Procedures are one way of executing repeated tasks with different parameters. Functions and procedures are called upon to do a specific task. A procedure may perform a simple task or even a complex task.
A stored procedure is a group of Transact-SQL statements compiled into a single execution plan. Stored procedures return data in fourways:
- Output parameters, which can return either data(such as an integer or character value) or a cursor variable( cursors are result sets that can be retreived one row at a time)
- Return codes, which are always an integer value.
- A result set for each SELECT statement contained in the stored procedure or any other stored procedures called by the stored procedure.
- A global cursor that can be referenced outside the stored procedure.
Create procedure procName
To execute the stored procedure we have to use exec command, EXEC procName.
If you are curious to learn more about Stored Procedures, you can join a .NET course. SLA IT Employment Training Company conducts good courses in .NET. Drop in at SLA for a free career counselling. For more details visit SLA Chennai or dial (91 44) 4200 5050/90.