Saturday, October 27, 2012

How to provide read only permissions to a user in SQL Server

There are many times when you want to add a user who has only the read only permissions in your SQL server database. Here is a script which you can use to provide the read only permission to a particular user in the SQL Server database.


 
  
 
EXEC sp_addrolemember N'db_datareader', N'userName'
 
db_datareader is the permission which gives only the read only permission
to a particular user
 
username is the name of the user you want to provide the permission. 
 
For Example :
EXEC sp_addrolemember N'db_datareader', N'Prashant'
 
 
For any confusion please comment below.

No comments:

Post a Comment