Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
2,884 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
What is the proper way to drop a DB in Azure Synapse?
Code from this documentation produces an error "SINGLE_USER is not supported for ALTER DATABASE".
Kill all active sessions before trying to drop the database.
Please try the following steps.
First, run the following script on the master database.
SELECT DB_NAME(database_id) AS DatabaseName, 'kill '+cast(session_id as varchar(10)), *
FROM sys.dm_exec_sessions
WHERE DB_NAME(database_id) NOT IN ('master')
ORDER BY DatabaseName
Second kill all sessions actively using the database with the output of the previous T-SQL script.
Finally, try to drop the database from Synapse Studio.