Creating a read-only database user in SQL Server

We typically recommend that you create a read-only trevor database user that Trevor can connect as.  You can do this easily by running the below commands against your SQL Server database:

-- STEP 1. Create user
CREATE LOGIN trevor WITH PASSWORD = 'secure_password';
CREATE USER trevor FOR LOGIN trevor
-- STEP 2. Grant select permissions
USE database_name_you_want_to_connect_to_trevor;
GRANT SELECT TO trevor;

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.