drop database

Removes one or more databases, including archive databases, from the SAP ASE server.

Syntax

drop database database_name [, database_name] ...

Parameters

Examples

Usage

  • When dropping an archive database, all the rows for that database are deleted from the sysaltusages table in the scratch database. This requires log space in the scratch database.

  • Removing a database deletes the database and all its objects, frees its storage allocation, and erases its entries from the sysdatabases and sysusages system tables in the master database.

  • drop database clears the suspect page entries pertaining to the dropped database from master..sysattributes.

When using encrypted columns and drop database, to prevent accidental loss of keys, drop database fails if the database contains keys currently used to encrypt columns in other databases. To drop a database:
  • Use alter table to decrypt the columns, or modify the columns for encryption using a different key.

  • Drop the table or database containing the encrypted columns.

See also sp_changedbowner, sp_helpdb, sp_renamedb, sp_spaceused in Reference Manual: Procedures.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

The permission checks for drop database differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be the database owner or have the own database privilege on the database. To drop sybsecurity, you must be the database owner or have the manage auditing privilege.

Disabled

With granular permissions disabled, you must be the database owner, a user with sa_role, or for sybsecurity, a user with sso_role.

Auditing

Values in event and extrainfo columns of sysaudits are:

InformationValues
Event

26

Audit option

drop

Command or access audited

drop database

Information in extrainfo
  • Roles – current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – NULL

  • Proxy information – original login name, if set proxy is in effect

Related reference
alter database
create database
dbcc
use