SQL-SEVER PERMISSIONS
علی ذوالفقار
1404/05/25 14:03:47 (6)
SQL-SERVER Permissions :
📄 Table-Level Permissions
Permission Description
----------------------------------------------------------------------
SELECT Read data from the table
INSERT Add new rows
UPDATE Modify existing rows
DELETE Remove rows
REFERENCES Create foreign key constraints referencing table
ALTER Modify table structure (e.g., add column)
CONTROL Full control over the object
TAKE OWNERSHIP Transfer ownership of the object
VIEW DEFINITION See metadata (e.g., column names, types)
🗂️ Schema-Level Permissions
Permission Description
----------------------------------------------------------------------
CREATE TABLE Create tables in the schema
CREATE PROCEDURE Create stored procedures
ALTER Alter schema objects
CONTROL Full control over the schema
🏢 Database-Level Permissions
----------------------------------------------------------------------
Permission Description
CONNECT Connect to the database
CREATE TABLE Create tables in the database
CREATE VIEW Create views
CREATE PROCEDURE Create stored procedures
BACKUP DATABASE Perform backups
CONTROL Full control over the database
VIEW ANY DATABASE See metadata of all databases
GRANT/DENY/REVOKE PERMISSION :
----------------------------------------------------------------------
GRANT SELECT ON TABLE_NAME TO MY_USER_NAME;
DENY SELECT ON TABLE_NAME TO MY_USER_NAME;
REVOKE SELECT ON TABLE_NAME FROM MY_USER_NAME;
GRANT OR DENY ALL TABLE LEVEL PERMISSION :
----------------------------------------------------------------------
GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER, CONTROL, TAKE OWNERSHIP, VIEW DEFINITION ON TABLE_NAME TO MY_USER_NAME;
DENY SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER, CONTROL, TAKE OWNERSHIP, VIEW DEFINITION ON TABLE_NAME TO MY_USER_NAME;