Is there any way to be sure that a table will be modified (INSERT/DELETE/UPDATE) only by stored procedures in SQL Server without touching the permissions?
-
1If you want a table only to be modified by a sproc you need to apply permissions to the table. In addition, deny any objects / any users / except for the user that needs to run the sproc as well as the sprocs.JonH– JonH2012-08-06 14:29:47 +00:00Commented Aug 6, 2012 at 14:29
-
You don't need to grant table permissions to the user running the SP. They will have permissions by nature of running the stored procedurepodiluska– podiluska2012-08-06 14:36:36 +00:00Commented Aug 6, 2012 at 14:36
Add a comment
|
2 Answers
Unfortunately i don't think there is a way to do it without touching permissions. The only way I know to do this is to
- setup a user that can only call SP's (no access to any tables).
- in each SP, you'll have to impersonate a user that has full access to the tables using "EXECUTE AS" (http://msdn.microsoft.com/en-us/library/ms188354.aspx)
- Applications then use the new user you created in step one to call SP's.
1 Comment
podiluska
You don't have to use execute as.