Grant / Revoke permissions in SQL Server
You can grant, grant, delegate or revoke on many objects in the database of SQL Server. This article will show you how to decentralize and revoke permissions.
Decentralize on the table
Can assign permissions to users on the table with the rights granted can include SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER or ALL.
Syntax
GRANT
quyen ON doi_tuong TO nguoi_dung;
Quyen
Permissions specified for the user. Maybe:
Right Description SELECT Ability to execute SELECT statement on INSERT table Ability to execute INSERT command on UPDATE table Ability to execute UPDATE command on DELETE table Ability to execute DELETE command on table REFERENCES Ability to create constraints refer to ALTER table The ability to execute the ALTER TABLE statement on the table to change the table definition. ALL ALL does not grant all rights on the table but grants rights under ANSI-92 standard, including SELECT, INSERT, UPDATE, DELETE and REFERENCES.Subjects
The name of the database object you want to empower. In the case of empowerment on the table, it is the table name.
nguoi_dung
Usernames will be empowered.
For example
If you want to grant SELECT, INSERT, UPDATE and DELETE permissions on the table for users to be smithj, run the GRANT command below.
G RANT SELECT, INSERT, UPDATE, DELETE ON nhanvien TO smithj;
You can use the ALL keyword to indicate that you want to grant all rights under ANSI-92 to smithj users.
GRANT ALL ON nhanvien TO smithj;
If you only want to grant SELECT permission on the table for all users, give it to the public rights group (PUBLIC).
GRANT SELECT ON nhanvien
TO PUBLIC;
See also: How to decentralize users in MS SQL Server
Revoke permissions on the board
After empowerment, you may want to revoke the given rights with the REVOKE command, withdraw the SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER or ALL permissions.
Syntax
REVOKE quyen ON doi_tuong FROM nguoi_dung;
Quyen
Rights will be revoked, possibly:
Right Description SELECT Ability to execute SELECT statement on INSERT table Ability to execute INSERT command on UPDATE table Ability to execute UPDATE command on DELETE table Ability to execute DELETE command on table REFERENCES Ability to create constraints refer to ALTER table The ability to execute the ALTER TABLE statement on the table to change the table definition. ALL ALL does not grant all rights on the table but grants rights under ANSI-92 standard, including SELECT, INSERT, UPDATE, DELETE and REFERENCES.Subjects
The name of the database object you want to revoke permissions. In the case of empowerment on the table, it is the table name.
nguoi_dung
User name will be revoked.
For example
If you want to revoke the DELETE permission on the user account of the anderson user, run the REVOKE command below.
REVOKE DELETE ON the user FROM anderson;
If you want to revoke the rights under ANSI-92 on the user table for user and userj, use the ALL keyword, run the GRANT command below.
REVOKE ALL ON the user FROM
anderson;
If you have given the SELECT permission to the public user group (all users) on the user table and want to revoke this permission, use the REVOKE command below.
REVOKE SELECT ON the user FROM PUBLIC;
Previous article: Index in SQL Server
The following article: CREATE LOGIN command in SQL Server
You should read it
May be interested
- How to edit application permissions on Androidsome applications such as pitu, when installed on android devices, require users to accept the terms, which is to access some settings on the device such as location, contacts, phone numbers, ... this inadvertently provided personal information for the application.
- How to grant Admin rights to a User in Win 10how to grant admin rights to a user in windows 10. to work effectively and ensure data on windows 10 computers, we often divide them into different users if the computer has 2 or more users. if you do not know how to grant admin rights to users in windows 10, please refer to the following tutorial!
- 5 best tools to manage app permissions on Androidhave you ever installed an app and found it suspicious asking for too many unnecessary permissions on the first run?
- How to Give System Permissions for Apps on MacOS Catalinastarting with macos 10.14 mojave, apple has introduced a new security feature that ensures third-party applications work safely with your data. in short, you need to manually grant permission to your apps, so they can work with files on...
- Network basics: Part 20 - File level permissionsin the previous part of this series, we introduced shared folders that can be protected using share level permissions or ntfs permissions.
- 12 best Linux server operating systemsalthough linux operating systems provide a great desktop environment, linux can also successfully complete the task of a server. linux often provides advanced permissions, increasing flexibility and stability.
- Efficiently exploit printers in Windows Server 2003 (Part 2)in part 1 of this article, i have shown you how to configure single printers to manage managed printers on a server running windows server 2.
- EXECUTE AS statement in SQL Server 2005in this article, we will explain the effect of the new execute as statement in sql server 2005 - execute as. this is a very useful utility for database administrators sql server 2005 when they need to check the permissions of each user.
- 4 Extremely useful MacBook security tips, did you know?did you know that the macbook has built-in customizations to help users manage and improve the security of the machine. please refer to how to increase the security of your macbook!
- Instructions to install NAS DS1621+ as a file server for businesses- in this article, techz will guide you step-by-step on how to set up nas ds1621+ as a file server for your business, including creating volumes, creating user & groups, setting up quick connect, creating folders, and assigning access permissions. for shared folder, create access for smb.