StoredProcedure
How to write insert,update,select in single storedProcedure
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
ajay rajuRank #4,639 · 333 reputationPosted May 17, 2010, 10:58 PM EDT
i give a example procedure try this. i am taken one class table in that table sno,sname,class these 3 are columns. i write single procedure to perform insert,update and select .
create procedure sp_ins_upd_sel
(
@sno_ins int, @sname_ins varchar(30), @class_ins int,
@sno_upd int,@sname_upd varchar(30),@class_upd int
)
as
begin
insert into class (sno,sname,class) values (@sno,@sname,@class)
update class set sname = @sname_upd,class = @class_upd where sno = @sno_upd
Select sno,sname,class from class
end
finally test the output test
sp_ins_upd_sel 5,'xxx',10,3,'rahul',7
i think it may helps you. if it helps please mark as accepted answer.
All the best
Thanks.
Venkatesan JayakanthamRank #256 · 9.8K reputationPosted Jun 7, 2010, 10:10 PM EDT
http://venkattechnicalblog.blogspot.com/
Cheers,
Venkatesan Prabu .J