HOW TO CREATE STORED PROCEDURE IN SQL SERVER

STEP 1:-  CREATE TABLE

CREATE TABLE tblEmployees
(
Id  int primary key,
EmpName   varchar(50),
Gender    varchar(50),
Salary    int
)



STEP 2:- CREATE STORED PROCEDURE

CREATE PROCEDURE USP_tblEmployees
(
@Id       int,
@EmpName  varchar(50),
@Gender   varchar(50),
@Salary   int
)
AS
BEGIN
INSERT INTO tblEmployees VALUES(@Id,@EmpName,@Gender,@Salary)
END

STEP 3:-  PASS VALUES TO SP

EXECUTE USP_tblEmployees 1,'mike','male',25000

OUTPUT

STEP 4:-

SELECT *FROM  tblEmployees

THEN SEE DATA IN YOUR TABLE




No comments:

Post a Comment