How to Store Procedure for Update Multi Record In Table

You can update multi record by using store procedure.
If is very easy and good processes, you not write store procedure
a lot of store procedure for update data a lot of row. but if you know about
update multi data you can reduce of write store procedure.
please see store procedure below:


ALTER PROCEDURE [dbo].[Pro_UpdateTblOption]
@optionOne varchar(50),
@optionTwo varchar(50),
@optionThree varchar(50),
@optionFour varchar(50),
@optionFive varchar(50),
@SMS varchar(30) Output
AS
Update tbl_Option Set parametervalue = @optionOne
Where optionID=1;
Update tbl_Option Set parametervalue = @optionTwo
Where optionID=2;
Update tbl_Option Set parametervalue = @optionThree
Where optionID=3;
Update tbl_Option Set parametervalue = @optionFour
Where optionID=4;
Update tbl_Option Set parametervalue = @optionFive
Where optionID=5;
Set @SMS='Update Successful...'

If is help you easy.

No comments:

Post a Comment