A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/sql/drop-external-table below:

DROP EXTERNAL TABLE | Snowflake Documentation

Reference SQL command reference Tables, views, & sequences DROP EXTERNAL TABLE DROP EXTERNAL TABLE

Removes an external table from the current or specified schema. This is a metadata-only operation. None of the files that the external table refers to are dropped.

See also:

CREATE EXTERNAL TABLE , ALTER EXTERNAL TABLE , SHOW EXTERNAL TABLES , DESCRIBE EXTERNAL TABLE

Syntax
DROP EXTERNAL TABLE [ IF EXISTS ] <name> [ CASCADE | RESTRICT ]

Copy

Parameters
name

Specifies the identifier for the external table to drop. If the identifier contains spaces, special characters, or mixed-case characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case sensitive; for example, "My Object".

If the external table identifier is not fully qualified, in the form of db_name.schema_name.table_name or schema_name.table_name, the command looks for the external table in the current schema for the session.

CASCADE | RESTRICT

Specifies whether the external table can be dropped if foreign keys exist that reference the table:

Default: CASCADE

Usage notes Examples

Drop an external table:

SHOW EXTERNAL TABLES LIKE 't2%';

+-------------------------------+------------------+---------------+-------------+-----------------------+---------+-----------------------------------------+------------------+------------------+-------+-----------+----------------------+
| created_on                    | name             | database_name | schema_name | owner                 | comment | location                                | file_format_name | file_format_type | cloud | region    | notification_channel |
|-------------------------------+------------------+---------------+-------------+-----------------------+---------+-----------------------------------------+------------------+------------------+-------+-----------+----------------------|
| 2018-08-06 06:00:42.340 -0700 | T2               | MYDB          | PUBLIC      | MYROLE                |         | @MYDB.PUBLIC.MYSTAGE/                   |                  | JSON             | AWS   | us-east-1 | NULL                 |
+-------------------------------+------------------+---------------+-------------+-----------------------+---------+-----------------------------------------+------------------+------------------+-------+-----------+----------------------+

DROP EXTERNAL TABLE t2;

+--------------------------+
| status                   |
|--------------------------|
| T2 successfully dropped. |
+--------------------------+

SHOW EXTERNAL TABLES LIKE 't2%';

+------------+------+---------------+-------------+-------+---------+----------+------------------+------------------+-------+--------+----------------------+
| created_on | name | database_name | schema_name | owner | comment | location | file_format_name | file_format_type | cloud | region | notification_channel |
|------------+------+---------------+-------------+-------+---------+----------+------------------+------------------+-------+--------+----------------------|
+------------+------+---------------+-------------+-------+---------+----------+------------------+------------------+-------+--------+----------------------+

Copy

Drop the table again, but don’t raise an error if the table doesn’t exist:

DROP EXTERNAL TABLE IF EXISTS t2;

+------------------------------------------------------------+
| status                                                     |
|------------------------------------------------------------|
| Drop statement executed successfully (T2 already dropped). |
+------------------------------------------------------------+

Copy


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4