T-SQL column update even from stored procedure

I have a question about ms sql permissions

I set the DENY permission for the UPDATE column

DENY UPDATE ON [MyTable] (MyColumn) TO [PrincipalName] ; 

It works fine (prevents updating MyColumn when I directly UPDATE MyTable MyColumn), but it still gives the user the ability to update this column using a stored procedure.

Is there any solution to this problem?

+4
source share
1 answer

Colin Mackay is right. A stored procedure encapsulates business logic and permissions.

You can use something like

 IF user_name()='PrincipalName' raiserror(N'Update denied',15,0) 

to validate a user in a stored procedure. Or you can create an update trigger for a table

0
source

Source: https://habr.com/ru/post/1485314/


All Articles