Linked Questions

-5 votes
1 answer
2k views

Finding users in the database owner role [duplicate]

I need a script which will list out all the users with the database owner permission for a specific database.
user avatar
2 votes
2 answers
529 views

How to find out all the permissions that belong to a specific server/ database role in SQL Server? [duplicate]

I can separately query all the server or database level permissions, but I want to know other thing. What server role do the given permissions exactly belong to? For example I want to see all the ...
user avatar
  • 2,036
46 votes
3 answers
86k views

The database principal owns a schema in the database, and cannot be dropped message

I am trying to delete a principal from the database but can't because it owns a schema. When I go to edit the user, however, the box to uncheck schemae is blue and unremovable. How can I remove the ...
user avatar
  • 821
7 votes
3 answers
15k views

How do I detect execute permission granted to a role (when no ON clause was used)

I just spent hours trying to figure out how an app had privilege to execute stored procedures. TIL from StackExchange: Turns out the ON clause is optional for GRANT, allowing a role to be granted ...
user avatar
4 votes
4 answers
834 views

SQL Server - How to prevent public connections?

Today we found that two of our SQL Servers (both 2017 CU21) are accepting connections from any random domain account, even those that most definitely do not have a direct login or access via AD group ...
user avatar
  • 468
0 votes
1 answer
4k views

Trying to add permission to a Role is failing

I am trying to add a role into Create and Restore permissions and After researching online, it sounds like it should be as easy as using the GRANT statement. So far so good. However, my simple grant ...
user avatar
  • 111
0 votes
1 answer
3k views

List of role permissions including other roles - how can I find out the roles that belong to other roles?

I can see the permissions of a role in a database using the scripts in List all permissions for a given role? However, It does not show me when the role belongs to a another role. For instance, on ...
user avatar
1 vote
1 answer
3k views

How do I write an SQL script to copy the securables, memberships and owned schemas of a current database user?

How do I write an SQL script to copy the securables, memberships and owned schemas of a current database user? I currently have to repeatedly restore databases on my local machine for development ...
user avatar
2 votes
1 answer
2k views

Database Role seemingly lost permission

I have a windows application that accesses a SQLServer database. Sometime within the last week or so it stopped working on other peoples machines with an exception thrown indicating they did not have ...
user avatar
3 votes
2 answers
267 views

Can I trust the effective permissions of default database roles?

I've granted membership in the db_datareader and db_datawriter roles for some testing being performed by a specific user. Looking at the names of each role, I know what the roles do. However, I want ...
user avatar
  • 343
1 vote
2 answers
590 views

How can I script administrator permissions on a SSAS server?

I am an administrator for a bunch of SSAS Instances. Sometimes I need to install or migrate SSAS instances to different machines or even different AD domains (we have a couple of different AD domains ...
user avatar
1 vote
2 answers
217 views

Get list of permisison for a SQL role

I have a role named db_executor and need to find out what permissions it has on what objects. I found List all permissions for a given role? but the only solution that remotely works is: SELECT ...
user avatar
1 vote
2 answers
245 views

sp_databaserestore: "stopat" gives error "no database backup found"

Unfortunately I get: “No backups for “database xxx” found in “\xxx\xxx$\…” as soon as I add the @StopAt = ‘2019-03-27T04:05:20 Parameter. When I comment this Parameter, everything works fine, ...
user avatar
0 votes
1 answer
147 views

List users permissions to tables and schemas on MSSQL 2016

List all permissions for a given role? has a nice query for listing users and their roles on a DB. How could we list all tables and users with their permissions on these tables?
user avatar
  • 1,413
0 votes
1 answer
160 views

List all users and permission

I found this script and find it is very helpful to me. I am new here and not good in coding. Can someone explain to me the below script the **'{All Users}'means? represent of? Appreciate your answer ...
user avatar
  • 1

15 30 50 per page