How to write the store procedure for Insert,Delete and Update the datas into the table in SQL

Here i explianed how to write the stored procedures in SQL for inserting,Updating and Deleting the the data's into the table. Following this article we discuss more in the sql procedures and if you have any queries dont hesitate to ask.

By using the below code we get an clear idea for to insert the data in SQL table
through procedures.

I have a table which have four columns [ID int set identity(1,1),Name varchar(50),PhoneNo int,State varchar(50)]

For Insert the datas---------------------------------


create procedure procname1
@Name varchar(50),
@PhoneNo int,
@State varchar(50)
Insert into tablename(Name,PhoneNo,State)

For Update the datas---------------------------------

create procedure procname2
@ID int,
@Name varchar(50),
@PhoneNo int,
@State varchar(50)
Update table tablename set Name=@Name,PhoneNo=@PhoneNo,State=@State
Where ID=@ID

For Delete the datas---------------------------------

create procedure procname3
@ID int
Delete from tablename where ID=@ID

Happy Coding friends i hope you get an clear idea in store procedures by the
above small examples


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: