---
title: "How to Create A Stored Procedure for Insert and Update Data ?"  
description: "How to Create A Stored Procedure for Insert and Update Data ?"  
author: "Anonymous User"  
published: 2018-07-31  
updated: 2018-07-31  
canonical: https://www.mindstick.com/forum/34639/how-to-create-a-stored-procedure-for-insert-and-update-data  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# How to Create A Stored Procedure for Insert and Update Data ?

\

## Replies

### Reply by Anonymous User

//---------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
```

\


---

Original Source: https://www.mindstick.com/forum/34639/how-to-create-a-stored-procedure-for-insert-and-update-data

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
