I have seen some guidance which recommends that you secure a database by layering all data access through stored procedures.
I know that for SQL Server, you can secure t
In stored procedures, you can add logic controls. You can return a error code if something is not right instead of update table data directly.
For example, you have a feedback system. Feedback can only be submitted after the administrat started the feedback campaign. It is simply updating a flag in some table. Then when user comes to submit feedback, SP can check if the flag is set.
Select @IsFeedbackDefined = IsFeedbackDefined From sometable where ID = @ID
IF @IsFeedbackDefined is Null or @IsFeedbackDefined = false
Begin
Return -2 --can not submit feedback
End