Share via


DROP DATABASE (U-SQL)

Summary

The statement drops the database and deletes all the data contained within from the system. If a database of the given name does not exist, or the user has no permissions to drop a database, an error is raised.

Warning

This operation cannot be undone!

Syntax

Drop_Database_Statement :=                                                                               
    'DROP' 'DATABASE' ['IF' 'EXISTS'] DB_Name.
DB_Name := Quoted_or_Unquoted_Identifier.

Remarks

  • DB_Name
    Specifies the name of the database to be dropped in form of a quoted or unquoted U-SQL identifier. If a database of the given name does not exist or the user has no permissions to drop a database, an error is raised.

  • IF EXISTS
    If the optional IF EXISTS is specified, then the statement drops the database if it already exists, or succeeds without changes if the database does not exist or the user has no permission to at least enumerate all existing databases.

Examples

  • The example can be executed in Visual Studio with the Azure Data Lake Tools plug-in.
  • The script can be executed locally. An Azure subscription and Azure Data Lake Analytics account is not needed when executed locally.

The following script shows how the TestReferenceDB database is deleted if it already exists before it is recreated:

DROP DATABASE TestReferenceDB; 

// with IF  EXISTS
DROP DATABASE IF EXISTS TestReferenceDB; 

See Also