MSSQL Stored Procedure Insert SQL Tutorial

How To Insert Data Using Stored Procedure In MSSQL Database Server Tutorial Example

Run microsoft sql server management studio query editor or any client tools you like then copy & paste the below code to create an stored procedure to insert data into a table usinq sql command or statement in MSSQL Database Server Tutorial Example

 CREATE PROCEDURE [SP_INSERT_DATA_EXECUTIVE]
 AS
 BEGIN
   INSERT INTO executives(lastname,department,salary)
   VALUES ('Hasan','RAFM System',60000),
   ('Prince','Mediation',50000),
   ('Mehedi','RAFM System',55000)
 END
 
 

Result in Microsoft Sql Server Management Studio Query Editor Client Tools :: Stored Procedure Created

 

Now we need to execute the stored procedure to insert some data into a table in MSSQL Database Server. To do so, run microsoft sql server management studio query editor or any client tools you like then copy & paste the below code.

   exec [SP_INSERT_DATA_EXECUTIVE]
 

   create the stored procedure [SP_INSERT_DATA_EXECUTIVE];
   if it is not created yet.

   -- is comment in MSSQL
   -- in fact it is comment in Oracle and MySQL as well

How To Insert Data Using Stored Procedure In MSSQL Database Server Tutorial Example - Result in Microsoft Sql Server Management Studio Query Editor Client Tools

No comments:

Post a Comment

leave your comments here..