How to Create A Stored Procedure for Insert and Update Data ?

Total Post:87

Points:615
 399  View(s)
Ratings:
Rate this:


  1. Post:286

    Points:2044
    Re: How to Create A Stored Procedure for Insert and Update Data ?

    //---------Create a procedure for Add new record--------//

    CREATE Proc ContactCreateOrUpdate
    
    @ContactID int,
    @Name varchar(50),
    @Mobile varchar(50),
    @Address varchar(50)

    AS
        BEGIN
           IF(@ContactID=0)
         Begin
             insert into Contact(Name,Mobile,Address) values(@Name, @Mobile, @Address)
         END

         Else
             Begin
             update Contact Set Name=@Name, Mobile=@Mobile, Address=@Address
          where ContactID=@ContactID
         END
       END


Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.