Is there a way to create an UPDATE stored_procedure with parameters such as:
@param1 int = null, @param2 int = null, @param3 nvarchar(255) = null, @param4 bit = null, @id int
and with an UPDATE statement that will only update fields that are not NULL
so if i do
spUpdateProcedure @param1=255, @id=1
if the @id = 1 record is updated, but it only changes the @ param1 field and ignores the changes in another @ param2,3,4 parameter.
In other words, it will not change the value for null in @ param2,3,4
Thanks.
source share