Rediger

Del via


Detach command (TMSL)

Applies to: SQL Server 2016 and later Analysis Services Azure Analysis Services Fabric/Power BI Premium

Detaches a tabular database from a server.

Request

{   
   "detach": {    
      "database":"AdventureWorksDW2014",  
      "password": "secret"  
   }  
}  

The properties accepted by the JSON detach command are as follows.

Property Default Description
database [Required] The name of the database object to be detached.
password Empty The password to use to encrypt secrets in the detached database.

Response

Returns an empty result when the command succeeds. Otherwise, an XMLA exception is returned.

Usage (endpoints)

This command element is used in a statement of the Execute Method (XMLA) call over an XMLA endpoint, exposed in the following ways:

  • As an XMLA window in SQL Server Management Studio (SSMS)

  • As an input file to the invoke-ascmd PowerShell cmdlet

  • As an input to an SSIS task or SQL Server Agent job

You can generate a ready-made script for this command from SSMS by clicking the Script button on the Detach dialog box.