SqlServer set specific user operation of a particular table (insert, delete, update, query permissions settings)


First, the demand scenario:

When docking and other vendors, will often let go of some of the tables of a database permissions CRUD (CRUD) to the other party, this time, we must create a new user, grant certain rights CRUD table of a database; there are only authorized when SELECT permissions, other permissions can not be granted;

Second, the steps:

The demo version of the database: SQL Server Management Studio V17.8.1

1, log SSMS select [security], right-click [login] in the pop-up menu, select New Login] [options;

Here Insert Picture Description

2, in the [General] tab, create a login name and set the default database;

Here Insert Picture Description

3, the user mapping [] is selected from the video card, check the database schema and settings [];

Here Insert Picture Description

4, the operation permission of the need to set permissions table, Table] - [] attributes;

TestDB already have two database tables, respectively, and User Salary, now User table permissions set permissions Insert, update, delete, select [zyl] assigned to the user;
1), the right table select [Property] select the tab [permission]:
Here Insert Picture Description
2), click on [Search], in the pop-up box, click [Browse], select the user to be set;
Here Insert Picture Description
3), in the above click OK, you're ready option in the [authority] card to see the list of permissions, select the required permissions and click OK;
Here Insert Picture Description
Here Insert Picture Description
4), elected in [select] and [quote] permission, you can also set permissions [column];
Here Insert Picture Description

5. Use [] zyl login database, you can only see the User table;

Here Insert Picture Description
[Zyl] and the user can only be CRUD User table, the table structure can not be modified;

Third, pay attention

1, in the list of permissions if you select the [setting], then another column permission settings [] does not make sense, because the inquiry has unrestricted;

If you set the [column] rights, no rights to select [Setup], then select * will error;
Here Insert Picture Description

2, in addition to set permissions on the table, but also can set permissions to view, and other functions;

In the [security] database - [user] - [zyl] - [Properties] - [security] objects;
Here Insert Picture Description


Guess you like

Origin www.cnblogs.com/willingtolove/p/11872006.html