@manhnguyenv

Welcome to my blog!

Update Stored Procedure - Only update change fields and leave others

December 26, 2017 17:24

Update Stored Procedure

https://stackoverflow.com/questions/43612860/update-stored-procedure-only-update-certain-fields-and-leave-others-as-is

ALTER
PROCEDURE [dbo].[spUpdateProduct] @ProductID int, @Brand nvarchar(30) = null, @ModelNo nvarchar(9) = null, ..... (to all the parameters except @ProductID) AS BEGIN SET NOCOUNT ON UPDATE tblProduct SET Brand = isNull(@Brand, Brand), ModelNo = isNull(@ModelNo, ModelNo), [Description] = isNull(@Description, Description),... WHERE ProductID = @ProductID END


Categories

Recent posts