Translate to Tamil

Best Offers

Bigbasket [CPS] IN

Amazon Best Offers

Amazon Offers

Offers

Online Income

Best Online Offers

Wikipedia

Search results

Thursday, 17 November 2011

Create Store Procedure Insert, Update and Delete With Example





First Create to Table : 


   Table Name "DistMast" ,Field : Distcode numeric (12),  Distname varchar(5)

                             Create table Reference Link : Click Me

Syntax :

Create procedure ProcName
as
 begin

    --- Your Query 
    ----should be return here


end


Execute the stored procedure

Exec ProcName

Example 

Create Procedure DistMast_SP(
@DistCode NUMERIC(10),
@DistName VARCHAR(50),
@Param  VARCHAR(10))
AS

Begin
      IF @Param='I'
            BEGIN
                  INSERT INTO CurMast(DistCode,DistName)
                  VALUES(@DistCode,@DistName)
            END
      ELSE IF @Param='U'
            BEGIN
                  update DistMast set DistName=@DistName 
                  where Distcode=@DistCode
            END
      ELSE IF @Param='D'
            BEGIN
                  Delete from DistMast where DistCode=@DistCode
            END
      
End


Execute Procedure

  Exce DistMast_SP


   

Comment Your Feedback And Don't Forget To Share Us! :-)



No comments:
Write comments

Infolinks

Services

© 2014