SPS Home > Dgreath > RDBMS > Data Control Language |
DATA CONTROL LANGUAGE |
---|
Access Control Model |
---|
Access ControlSQL features a three level access control model consisting of login, user, and permission levels. The login level allows access to an instance of sqlserver with the assignment of id and password to a user with the CREATE LOGIN statement or to terminate access with the DROP LOGIN statement. Logins can be either Windows logins or SQL id/passwords. The user level allows a given login access to one or more databases with the CREATE USER statement or to terminate access with the DROP USER statement. Finally, individual users are granted some combination of permissions to select, insert, update, or delete rows from tables within the database with the GRANT statement or to remove those permissions with the REVOKE statement. |
Create Login |
CREATE LOGIN StatementThe CREATE LOGIN statement adds a specified user to a database. It has the following general format: CREATE LOGIN Examples |
Drop Login |
DROP LOGIN StatementThe DROP LOGIN statement removes a specified user from a database. It has the following general format DROP LOGIN Examples |
Create User |
CREATE USER StatementThe CREATE USER statement adds a specified user to a database. It has the following general format: CREATE USER Examples |
Drop User |
DROP USER StatementThe DROP USER statement removes a specified user from a database. It has the following general format DROP USER Examples |
Grant |
GRANT StatementThe GRANT Statement grants access privileges for database objects to other users.
It has the following general format: The GRANT statement grants each privilege in privilege-list for each
object (table) in object-list to each user in user-list. In
general, the access privileges apply to all columns in the table or view, but it
is possible to specify a column list with the UPDATE privilege specifier: The user-list may specify PUBLIC. This is a general grant, applying to all users (and future users) in the catalog. Privileges granted are revoked with the REVOKE statement. The optional specificier WITH GRANT OPTION may follow user-list in the GRANT statement. WITH GRANT OPTION specifies that, in addition to access privileges, the privilege to grant those privileges to other users is granted. GRANT ExamplesGRANT SELECT ON s,sp TO PUBLIC GRANT SELECT,INSERT,UPDATE(color) ON p TO art,nan GRANT SELECT ON supplied_parts TO sam WITH GRANT OPTION
|
Revoke |
REVOKE StatementThe REVOKE Statement revokes access privileges for database objects previously granted
to other users. It has the following general format: The user-list may specify PUBLIC. This must apply to a previous GRANT TO PUBLIC. REVOKE ExamplesREVOKE SELECT ON s,sp FROM PUBLIC REVOKE SELECT,INSERT,UPDATE(color) ON p FROM art,nan REVOKE SELECT ON supplied_parts FROM sam
|