Views: a GRANT test rerun, the user fails

Views:

View appears like a table to the database user with
many rows and columns of data. Views is a virtual table. With views users are
restricted from viewing particular columns and rows which ensures that data is
not manipulated or seen by   unauthorized
people.  It is helpful to turn
information from multiple tables into a single view. It is used to hide the
complicated queries.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

Example of creating view:

CREATE VIEW
vtest AS select
voterid,votername  from
voterstable.

 

Grant:

For a user to do anything on an SQL Server, he or she
must have permission. Such permission is accorded via a GRANT command. With
grant command we will give permissions to a user that can perform on databases
or database objects. The different permissions are create database object, or
retrieve information from database objects, or manipulate the database
objects. 

Granting privileges on Table:

If we want a user to insert the data into the table
then first user has to grant to perform insert operation on table by using

GRANT INSERT ON employee to
test_user

We also have WITH GRANT option for GRANT command which
indicates the granted user has a right to grant same privilege to other user.

 

Deny:

DENY blocks access. DENY affects
all other access. For instance, when a user has both DENY and GRANT to an
object, DENY takes effect. DENY locks access while Revoking a DENY re-forms the
access. Consequently, issuing a REVOKE to an object without permission at the
user level causes no error. The GRANT command succeeds at the SQL Server level.
DENY statement is used to deny already
existing permissions for groups (roles) to a few members of the group.

 

Example:

 

DENY CREATE TABLE, CREATE PROCEDURE to  test_user

 

Revoke:

Revoke remove or undo permission undoes any prior permission,
whether a GRANT or a DENY. For example, when Revoke is issued, and a GRANT test
rerun, the user fails to see the previous query. Revoke is never meant to block
or cancel a GRANT, it just removes the permission issues to a specific user at
specific level.

Example:

REVOKE INSERT ON employee FROM
test_user;