DROP SCHEMA (U-SQL)

Summary

The statement drops the schema in the current database context and deletes all the data contained within from the system.

Warning

This operation cannot be undone!

Syntax

Drop_Schema_Statement :=                                                                                 
    'DROP' 'SCHEMA' ['IF' 'EXISTS'] Schema_Name.
Schema_Name := Quoted_or_Unquoted_Identifier.

Remarks

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

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

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 My Schema schema is deleted from the current database context if it already exists before it is recreated:

DROP SCHEMA IF EXISTS [My Schema];  
CREATE SCHEMA [My Schema];  

See Also