Understanding SQL Server security
SQL Server security determines what information is returned to a user who submits a query. It can be applied at the server, database, schema, table, row, or column level. Each authorized user of a database can only view data that they are authorized to see. Often, when two different people run the same query and they get different results, it is because they do not have the same access to the same tables or data.
Security is typically managed by the database administrator (DBA). If you are not getting the results that you were expecting, you may need to contact the DBA to have the access granted to you.
Security for tables and columns is applied through Grant
or Deny
statements run by the DBA and look like this: GRANT SELECT ON SCHEMA.TABLE
or DENY SELECT
ON SCHEMA.TABLE
.
For column access, it is the same command with the list of columns to allow or deny access to. Here is what they look like:
GRANT SELECT ON SCHEMA.TABLE(COLUMN 1, COLUMN...