I am creating a reporting server which will run certain reports.

The reports are created by me and saved as SQL files.

The reporting application has read/write access, for good reasons.

Is there a way I can deprivilege a SQL session so that when executing the SQL it will use less privileges for execution than the application has available?


If you use Roles to control access to your tables, you can set a "read-only" role after opening the database connection:

set role read_only_role; 

Where this role has select access on the target tables.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.