StoredProcedure
How to write insert,update,select in single storedProcedure
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Venkatesan JayakanthamPosted Jun 8, 2010, 2:10 AM
http://venkattechnicalblog.blogspot.com/
Cheers,
Venkatesan Prabu .J
ajay rajuPosted May 18, 2010, 2:58 AM
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.