Udostępnij za pośrednictwem


DROP ROLE (Transact-SQL)

Powoduje usunięcie roli z bazy danych.

Topic link iconKonwencje składni języka Transact-SQL

DROP ROLE role_name

Argumenty

  • role_name
    Określa rolę zostanie usunięty z bazy danych.

Remarks

Role, których właścicielem securables nie mogą być usunięte z bazy danych.Aby usunąć rola bazy danych, która jest właścicielem securables, należy pierwszy własność transferu tych securables lub usuwanie ich z bazy danych.Role, których członkowie nie mogą być usunięte z bazy danych.Aby usunąć rolę, która zawiera składniki, musisz najpierw usunąć członków roli.

Za pomocą DROP ROLE nie można upuścić stała rola bazy danych.

Informacje o członkostwo w roli można wyświetlać w sys.database_role_members Służy do wyświetlania katalogu.

Ostrzeżenie

Beginning with SQL Server 2005, the behavior of schemas changed. As a result, code that assumes that schemas are equivalent to database users may no longer return correct results. Old catalog views, including sysobjects, should not be used in a database in which any of the following DDL statements have ever been used: CREATE SCHEMA, ALTER SCHEMA, DROP SCHEMA, CREATE USER, ALTER USER, DROP USER, CREATE ROLE, ALTER ROLE, DROP ROLE, CREATE APPROLE, ALTER APPROLE, DROP APPROLE, ALTER AUTHORIZATION. In such databases you must instead use the new catalog views. The new catalog views take into account the separation of principals and schemas that was introduced in SQL Server 2005. For more information about catalog views, see Catalog Views (Transact-SQL).

Uprawnienia

Wymaga uprawnienie Kontrola do roli lub ALTER ROLE bez uprawnień do bazy danych.

Przykłady

W poniższym przykładzie spadnie rola bazy danych purchasing z AdventureWorks.

USE AdventureWorks;
DROP ROLE purchasing;
GO