SQL Store Procedure Assignment Help
SQL Store Procedure is a sql statement which perform specific task. Store Procedure is consists of header and body, the header part is consists of the name of the procedure and the parameters or variable passed to the procedure and the body part is a declare section or execution of the store procedure.
There many benefit of using store procedure like it increases the performance of the database, it decrease the amount of data to be send to the sql server etc.
Procedures: Passing Parameters
We can pass parameters to procedures in three ways.
- 1) IN-parameters
- 2) OUT-parameters
- 3) IN OUT-parameters
SQL Store Procedure Assignment Help By Online Tutoring and Guided Sessions from AssignmentHelp.Net
Store Procedure Syntax:
{` Create Procedure Procedure-name ( Input parameters, Output Parameters (If required) ) As Begin Sql statement used in the stored procedure End ->Where Procedure-name is the name of the procedure. `}
Procedures Example:
In the table Person fields PersonID, First-Name, Last-Named, Phone_No.
PersonID | First-Name | Last-Named | Phone_No |
---|---|---|---|
1 | John | Sena | 123456 |
2 | David | wak | 455665 |
3 | Gorge | ham | 687800 |
{` Create PROCEDURE Getpersonname ( @PersonID INT --Input parameter, PersonID of the person ) AS BEGIN SELECT First-name+' '+Last-name FROM person WHERE PersonID=@PersonID END `}