. Advertisement .
..3..
. Advertisement .
..4..
Here is the program I run:
create user test from login test with default_schema=[dbo]
exec sp_addrolemember 'db_owner','test'
After I run, it returns an error:
The SELECT permission was denied on the object 'Users', database 'XXX', schema 'dbo'
Does anyone have any suggestions for the problem below: the select permission was denied on the object in the sql – How to correct it?
The cause:
This error happens because the user you created doesn’t have enough privileges to access the tables in your database.
Solution:
Provide enough privileges for the user so as to get what you expect.
Some determined permissions on table in that database such as SELECT, INSERT, UPDATE and DELETE should be granted for the user.
You can refer about how to grant SELECT permisson to the table below:
If you want to grant SELECT permission to a table, you can follow this syntax:
If you want to grant SELECT permission to all tables in the database, let’s do the following:
Properties
.Membership
.Check that you do not check
db_denydatareader
db_denydatawriter
This should be obvious, but it is important to only give permissions to the users who need them. This is a quick and easy way to fix security issues.