Thumb

Insert Statement Inside a Stored Procedure

9/14/2020 7:12:41 AM

Insert Statement Inside a Stored Procedure: In this code we create a stored procedure for insert the data into salary table then we insert the values by EXEC the stored procedure then gets the data by before create the DetData stored procedure. Now given bellow the example code:

/*CREATE PROCEDURE*/
CREATE PROCEDURE InsertData
AS
BEGIN
SET NOCOUNT ON
INSERT INTO Salary(FirstName, LastName, Gendar, Salary, Department)
VALUES ('Reza', 'Karim', 'Male', '50000', 'CSE');
END
/*Insert data*/
EXEC [dbo].[InsertData]
/*show data*/
EXEC [dbo].[GetData]

In this code we see the create stored procedures for insert data then using procedure name insert data into table then GetData procedure using show the all data.