Contact Me

Nirav Prabtani

Mobile : +91 738 308 2188

Email : niravjprabtani@gmail.com

Nirav Prabtani

Wednesday 16 July 2014

How to use insertion and deletion of row using stored procedure.

How to use insertion and deletion of row using stored procedure.


try operational stored procedure.
You have to declare variable @operation with int datatype like as shown below,
Now you can execute perticular query with just passing @operation from backend.
 
You can put both query in one operation as you wish.
You can execute multiple operations with this query.... Smile | :) 

CREATE PROCEDURE SP_MyQuery
     @ItemCode VARCHAR(50)=''
    ,@ItemDescription VARCHAR(250)=''
    ,@ItemCategoryID INT=0
,@ItemID INT=0
,@operation int=0
AS
BEGIN
IF(@operation=1)
begin
--What ever you want to execute, insert query , update query , delete query, select query
end
ELSE IF(@operation-2)
BEGIN
--What ever you want to execute, insert query , update query , delete query, select query
END
END

No comments :

Post a Comment