Creating a simple stored procedure.

Stored procedure can reduced network traffic and latency, boosting application performance.Stored procedure execution plans can be reused, staying cached in SQL Server memory, reducing server overhead.Stored procedures help promote code reuse.Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients.Stored procedures provide better security to your data.

Before you create a stored procedure you need to create a table-

CREATE TABLE Employee(

[ID] [int] IDENTITY(1,1) NOT NULL,

[EmployeeCode] [nvarchar](100) NOT NULL,

[EmployeeName] [nvarchar](100) NOT NULL,

[Mobile] [nvarchar](100) NOT NULL,

[Email] [nvarchar](100) NULL,

[Password] [nvarchar](100) NULL,

                            ) 


Procedure for inserting data in Employee table-

CREATE PROCEDURE Employee 

(

@ID INT = NULL,

@EmployeeName  NVARCHAR(100) = NULL,

@EmployeeCode NVARCHAR(50)=null,

@Mobile  NVARCHAR(100) = NULL,

@Email  NVARCHAR(100) = NULL,

@Password  NVARCHAR(100) = NULL,

@flag  VARCHAR(100) =NULL out

)

AS

BEGIN

   INSERT INTO UserMaster([EmployeeCode],[EmployeeName],[Mobile],[Email],[Password],[CrBy],[IsActive])

   VALUES(@EmployeeCode,@EmployeeName,@Mobile,@Email,@Password,@User,@IsActive) ;

   SET @flag='success'; 

 END

Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*