Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql server user permissions and roles

-- SQL Server: list of users and roles
SELECT dp.NAME      AS principal_name,
       dp.TYPE_DESC AS principal_type_desc,
       o.NAME       AS object_name,
       p.PERMISSION_NAME,
       p.STATE_DESC AS permission_state_desc
FROM sys.database_permissions p
         LEFT OUTER JOIN sys.all_objects o
                         ON p.MAJOR_ID = o.OBJECT_ID
         INNER JOIN sys.database_principals dp
                    ON p.GRANTEE_PRINCIPAL_ID = dp.PRINCIPAL_ID;
Comment

SQL server how to see user permissions on objects

SELECT dp.NAME      AS principal_name,
       dp.TYPE_DESC AS principal_type_desc,
       o.NAME       AS object_name,
       p.PERMISSION_NAME,
       p.STATE_DESC AS permission_state_desc
FROM sys.database_permissions p
         LEFT OUTER JOIN sys.all_objects o
                         ON p.MAJOR_ID = o.OBJECT_ID
         INNER JOIN sys.database_principals dp
                    ON p.GRANTEE_PRINCIPAL_ID = dp.PRINCIPAL_ID
					where dp.name = 'TMM209411'
Comment

PREVIOUS NEXT
Code Example
Sql :: list all tables in postgres 
Sql :: convert multiple columns to rows in sql server 
Sql :: Get first name and last name from full name string in SQL 
Sql :: with postgres 
Sql :: drop a view in sqlite 
Sql :: inner join distinct 
Sql :: postgress connection refused 
Sql :: python uuid sqlalchemy 
Sql :: sql format time 
Sql :: sql query to select even numbers 
Sql :: mysql order by two columns priority 
Sql :: mysql remove records 
Sql :: check database sessions oracle 
Sql :: restart serial number for postgres 
Sql :: Index a database column sql 
Sql :: drop CHECK constraint sql 
Sql :: create table with index mysql 
Sql :: pgsql is not permitted to log in 
Sql :: view table sql 
Sql :: duplicate key value violates unique constraint in postgresql 
Sql :: sql server pivot rows to columns 
Sql :: how to get initials in sql 
Sql :: QL HAVING Keyword 
Sql :: psql no such file or directory 
Sql :: mysql time 
Sql :: oracle dynamic select into 
Sql :: get duplicate entry sql 
Sql :: sql drop table 
Sql :: select only the month-day from date in PL-SQL 
Sql :: run docker container with database as rds metabase 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =