--- title: "ALTER DATABASE SCOPED CONFIGURATION" titleSuffix: SQL Server (Transact-SQL) description: Enable several database configuration settings at the individual database level. author: markingmyname ms.author: maghan ms.reviewer: katsmith, jovanpop ms.date: 08/03/2022 ms.prod: sql ms.prod_service: "database-engine, sql-database" ms.technology: t-sql ms.topic: reference ms.custom: - "seo-lt-2019" - "event-tier1-build-2022" f1_keywords: - "ALTER_DATABASE_SCOPED_CONFIGURATION" - "ALTER_DATABASE_SCOPED_CONFIGURATION_TSQL" - "DATABASE_SCOPED_CONFIGURATION_TSQL" - "SCOPED_CONFIGURATION_TSQL" - "SCOPED_TSQL" - "ALTER_DATABASE_SCOPED_TSQL" - "DATABASE_SCOPED_TSQL" helpviewer_keywords: - "ALTER DATABASE SCOPED CONFIGURATION statement" - "configuration [SQL Server], ALTER DATABASE SCOPED CONFIGURATION statement" dev_langs: - "TSQL" monikerRange: "=azuresqldb-current||=azuresqldb-mi-current||>=sql-server-2016||>=sql-server-linux-2017||=azure-sqldw-latest" --- # ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL) [!INCLUDE[sqlserver2016-asdb-asdbmi-asa.md](../../includes/applies-to-version/sqlserver2016-asdb-asdbmi-asa.md)] This command enables several database configuration settings at the **individual database** level. > [!IMPORTANT] > Different `DATABASE SCOPED CONFIGURATION` options are supported in different versions of SQL Server or Azure services. This page describes **all** `DATABASE SCOPED CONFIGURATION` options. Versions where applicable are described in the text below. Make sure that you use the syntax that is available in the version of service that you are using. The following settings are supported in [!INCLUDE[sssdsfull](../../includes/sssdsfull-md.md)], [!INCLUDE[ssSDSMIfull](../../includes/sssdsmifull-md.md)] and in [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] as indicated by the **Applies to** line for each setting in the [Arguments](#arguments) section: - Clear procedure cache. - Set the MAXDOP parameter to a recommended value (1,2, ...) for the primary database based on what works best for that particular workload, and set a different value for secondary replica databases used by reporting queries. For guidance on choosing a MAXDOP, review [Configure the max degree of parallelism Server Configuration Option](../../database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option.md). - Set the query optimizer cardinality estimation model independent of the database to compatibility level. - Enable or disable parameter sniffing at the database level. - Enable or disable query optimization hotfixes at the database level. - Enable or disable the identity cache at the database level. - Enable or disable a compiled plan stub to be stored in cache when a batch is compiled for the first time. - Enable or disable collection of execution statistics for natively compiled [!INCLUDE[tsql](../../includes/tsql-md.md)] modules. - Enable or disable online by default options for DDL statements that support the `ONLINE =` syntax. - Enable or disable resumable by default options for DDL statements that support the `RESUMABLE =` syntax. - Enable or disable [Intelligent query processing](../../relational-databases/performance/intelligent-query-processing.md) features. - Enable or disable accelerated plan forcing. - Enable or disable the auto-drop functionality of global temporary tables. - Enable or disable the [lightweight query profiling infrastructure](../../relational-databases/performance/query-profiling-infrastructure.md). - Enable or disable the new `String or binary data would be truncated` error message. - Enable or disable collection of last actual execution plan in [sys.dm_exec_query_plan_stats](../../relational-databases/system-dynamic-management-views/sys-dm-exec-query-plan-stats-transact-sql.md). - Specify the number of minutes that a paused resumable index operation is paused before it is automatically aborted by the [!INCLUDE[ssde_md](../../includes/ssde_md.md)]. - Enable or disable waiting for locks at low priority for asynchronous statistics update. - Enable or disable uploading ledger digests to Azure Blob Storage or Azure Confidential Ledger. This setting is only available in [!INCLUDE[ssazuresynapse_md](../../includes/ssazuresynapse_md.md)]. - Set the compatibility level of a user database ![link icon](../../database-engine/configure-windows/media/topic-link.gif "link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ```syntaxsql -- Syntax for SQL Server, Azure SQL Database and Azure SQL Managed Instance ALTER DATABASE SCOPED CONFIGURATION { { [ FOR SECONDARY] SET } } | CLEAR PROCEDURE_CACHE [plan_handle] | SET < set_options > [;] < set_options > ::= { MAXDOP = { | PRIMARY} | LEGACY_CARDINALITY_ESTIMATION = { ON | OFF | PRIMARY} | PARAMETER_SNIFFING = { ON | OFF | PRIMARY} | QUERY_OPTIMIZER_HOTFIXES = { ON | OFF | PRIMARY} | IDENTITY_CACHE = { ON | OFF } | INTERLEAVED_EXECUTION_TVF = { ON | OFF } | BATCH_MODE_MEMORY_GRANT_FEEDBACK = { ON | OFF } | BATCH_MODE_ADAPTIVE_JOINS = { ON | OFF } | TSQL_SCALAR_UDF_INLINING = { ON | OFF } | ELEVATE_ONLINE = { OFF | WHEN_SUPPORTED | FAIL_UNSUPPORTED } | ELEVATE_RESUMABLE = { OFF | WHEN_SUPPORTED | FAIL_UNSUPPORTED } | OPTIMIZE_FOR_AD_HOC_WORKLOADS = { ON | OFF } | XTP_PROCEDURE_EXECUTION_STATISTICS = { ON | OFF } | XTP_QUERY_EXECUTION_STATISTICS = { ON | OFF } | ROW_MODE_MEMORY_GRANT_FEEDBACK = { ON | OFF } | MEMORY_GRANT_FEEDBACK_PERCENTILE = { ON | OFF } | MEMORY_GRANT_FEEDBACK_PERSISTENCE = { ON | OFF } | BATCH_MODE_ON_ROWSTORE = { ON | OFF } | DEFERRED_COMPILATION_TV = { ON | OFF } | ACCELERATED_PLAN_FORCING = { ON | OFF } | GLOBAL_TEMPORARY_TABLE_AUTO_DROP = { ON | OFF } | LIGHTWEIGHT_QUERY_PROFILING = { ON | OFF } | VERBOSE_TRUNCATION_WARNINGS = { ON | OFF } | LAST_QUERY_PLAN_STATS = { ON | OFF } | PAUSED_RESUMABLE_INDEX_ABORT_DURATION_MINUTES =