Pages

Sunday, March 7, 2010

SQL Server - INSERT through Stored Procedure

There is one article in this blog in which we had discussed about how to use INSERT statement in various aspects. Here is one more example to insert the data into the table through a stored procedure.

/**************************/
/* Existing Table Data */
/**************************/
SELECT * FROM Customers

/**************************/
/* Procedure Creation */
/**************************/
CREATE PROCEDURE sampleProc (
@CustomerID INT,
@CustomerName VARCHAR(50),
@ActiveStatus INT)

AS


SELECT @CustomerID, @CustomerName, @ActiveStatus

**************************/
/* Procedure Ends Here*/
/**************************/


/**************************/
/* Insert Data */
/**************************/
INSERT INTO Customers
EXEC sampleProc 500, 'Harry', 1

1 comment:

  1. No words to Praise you!

    Thank you very much Mr. Shafi for such a useful and informative blog. You'll be blessed by GOD for such an extraordinarly hard work.

    ReplyDelete