I have a MS SQL database with some very, very sensitive data. If anything gets broken, half of the planet will fall into chaos. Almost :-).

I have a database user with some restricted permissions, but not restricted enough, I could do some damage if I made a mistake. Basicaly I just need to do a SELECT from some tables with some fancy sorting, filtering, joining etc. So I would like to use some client software (I am used to HeidiSQL). However I am really afraid of some stupid click on a wrong button and damaging the data.

Is there any way to restrict my own permissions for just one database session? Or is there any safe tool, which provides read-only mode? HeidiSQL does not, unfortunately.

1 Answer 1


I think the only safe way to do this is on the DBMS side. Like you said, some user might do something wrong by accident, or worse, could do something wrong on purpose. In SQL Server you can add the user to the db_datareader role which only allows the user to do SELECT:

Members of the db_datareader fixed database role can run a SELECT statement against any table or view in the database.

You can create a new user with that role by running the following command on the database server:

exec sp_addrolemember 'db_datareader',YourLogin


With this restricted user you can let other users explore the data with any client, such as HeidiSQL, without them being able to change anything in the database.

  • Thank you for your answer! However, this is not what I was really looking for... Thank you, anyway.
    – vojta
    Commented Nov 7, 2015 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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