SQl Server 2008
example:
on the page to edit user profile settings like DOB, gender, name etc…, I wouldn’t know which columns user wanted me to update. Should I pass in all these values to the stored procedure, and update all of the profile columns values even though the user may have changed only one or two of them? It seems a little bad, is it?
Using dynamic sql is not an option due to security concerns.
Create a stored procedure that has default parameters set to null. Then just supply the parameters that you want to change. In the
updatestatement, check for null values like thisAge = isnull(@Age, Age).See the example below: