CREATE SHARE

適用於:檢查標示為是Databricks SQL 檢查標示為是 Databricks Runtime 10.4 LTS 和更新版本檢查標示為是僅限 Unity 目錄

建立具有指定名稱的共用。 如果具有相同名稱的共享已經存在,則會擲回例外狀況。

若要建立共用,您必須是中繼存放區系統管理員,或具有 CREATE SHARE 您要共用數據的 Unity 目錄中繼存放區的許可權。

若要將內容新增至共用,請使用 ALTER SHARE

語法

CREATE SHARE [ IF NOT EXISTS ] share_name
    [ COMMENT comment ]

參數

  • share_name

    要建立的共享名稱。

  • 如果不存在

    如果指定名稱不存在,請建立具有指定名稱的共用。 如果具有相同名稱的共享已經存在,則不會發生任何動作。

  • comment

    選擇性常 STRING 值。 共用的描述。

範例

-- Create share `customer_share`. This throws exception if a share with name customer_share
-- already exists.
> CREATE SHARE customer_share;

-- Create share `customer_share` only if share with same name doesn't exist.
> CREATE SHARE IF NOT EXISTS customer_share;

-- Create share `customer_share` only if share with same name doesn't exist, with a comment.
> CREATE SHARE IF NOT EXISTS customer_share COMMENT 'This is customer share';