Granting permissions on tables and views

You can assign a set of permissions on individual tables and views. Users can be granted combinations of these permissions to define their access to a table or view.

Combinations of permissions

Example

All table and view permissions are granted in a very similar fashion. You can grant permission to M_Haneef to delete rows from the table named sample_table as follows:

  1. Connect to the database as a user with DBA authority, or as the owner of sample_table.

  2. Type and execute the SQL statement:

GRANT DELETE
ON sample_table
TO M_Haneef

You can grant permission to M_Haneef to update the column_1 and column_2 columns only in the table named sample_table as follows:

  1. Connect to the database as a user with DBA authority, or as the owner of sample_table.

  2. Type and execute the SQL statement:

    GRANT UPDATE (column_1, column_2)
    ON sample_table
    TO M_Haneef
    

Table and view permissions are limited in that they apply to all the data in a table or view (except for the UPDATE permission which may be restricted). Finer tuning of user permissions can be accomplished by creating procedures that carry out actions on tables, and then granting users the permission to execute the procedure.

Granting user permissions on tables in Sybase Central

One way to grant a user permissions on a table in Sybase Central is as follows:

StepsGranting user permission on tables in Sybase Central

  1. Connect to the database.

  2. Double-click the Tables folder for that database, to display the tables in the left panel.

  3. Right-click a table and choose Properties from the popup menu.

  4. On the Permissions tab of the Properties dialog, configure the permissions for the table:

    • Click Grant to select users or groups to which to grant full permissions.

    • Click in the fields beside the user or group to set specific permissions. Permissions are indicated by a check mark, and grant options are indicated by a check mark with two ‘+’ signs.

    • Select a user and click the button beside References, Select, or Update to set that type of permission on individual columns.

    • Select a user or group in the list and click Revoke to revoke all permissions.

Legend for the columns on Permissions tab:

You can also assign permissions from the Users & Groups property sheet. To assign permissions to many users and groups at once, use the table’s property sheet. To assign permissions to many tables at once, use the user’s property sheet.