Is there a way to create UPDATE stored_procedure with parameters like:
@param1 int = null,
@param2 int = null,
@param3 nvarchar(255) = null,
@param4 bit = null,
@id int
and with UPDATE statement which will update only fields which are not NULL
so if I execute
spUpdateProcedure @param1=255, @id=1
if will update record @id=1 but it will change only field @param1 and will ignore changes to other @param2,3,4.
In other words, it wont change value for null in @param2,3,4
Thanks.
1 Answer