|
| 1 | +--- |
| 2 | +title: SQL Projects Properties |
| 3 | +description: "Learn about the properties that you can set for SQL database projects." |
| 4 | +author: dzsquared |
| 5 | +ms.author: drskwier |
| 6 | +ms.reviewer: randolphwest |
| 7 | +ms.date: 02/19/2025 |
| 8 | +ms.service: sql |
| 9 | +ms.subservice: sql-database-projects |
| 10 | +ms.topic: concept-article |
| 11 | +--- |
| 12 | + |
| 13 | +# SQL projects properties |
| 14 | + |
| 15 | +[!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB](../../../includes/applies-to-version/sql-asdb-asdbmi-fabricsqldb.md)] |
| 16 | + |
| 17 | +In addition to the contents of the individual `.sql` files, SQL database projects contain properties that define the project's behavior and database-level settings. These properties are stored in the `.sqlproj` file and can be set by editing the `.sqlproj` file directly. Some SQL projects tools, such as Visual Studio and VS Code, provide access to edit a few or many of the project properties in a graphical user interface. This article provides an overview of the properties that you can set for SQL database projects. |
| 18 | + |
| 19 | +Commonly used SQL projects properties include: |
| 20 | + |
| 21 | +- [Target platform (DSP)](target-platform.md) |
| 22 | +- [Code analysis](sql-code-analysis/sql-code-analysis.md) |
| 23 | +- [DacApplicationName and DacVersion](#data-tier-application-properties) |
| 24 | +- [Default schema](#default-schema) |
| 25 | +- [TreatTSqlWarningsAsErrors](#t-sql-warnings) |
| 26 | + |
| 27 | +## Disable database options changes |
| 28 | + |
| 29 | +During SQL project publish, changes to the database options are scripted based on the values defined in the project properties and default project values. To prevent the database options from being modified during publish, using a tool like [SqlPackage CLI](../../sqlpackage/sqlpackage-publish.md) or Visual Studio, set the publish property to `ScriptDatabaseOptions` to false. This setting can also be incorporated in a publish profile. |
| 30 | + |
| 31 | +## Common project properties |
| 32 | + |
| 33 | +The [target platform](target-platform.md) property specifies the version of SQL Server that the project targets. The `DSP` property is used to set the target platform for the SQL project. More information on the target platform can be found in the [target platform](target-platform.md) article. |
| 34 | + |
| 35 | +Code analysis can dramatically improve the continuous integration and deployment process by catching potential issues early in the development lifecycle. Learn more about enabling code analysis and including custom rules in the [SQL code analysis](sql-code-analysis/sql-code-analysis.md) article. |
| 36 | + |
| 37 | +### Data-tier application properties |
| 38 | + |
| 39 | +The following properties are used to define the data-tier application (DAC) that is created when the SQL project is built. |
| 40 | + |
| 41 | +- **DacApplicationName**: The name of the data-tier application `.dacpac`. The default value is the project name. |
| 42 | +- **DacDescription**: An optional description of the data-tier application `.dacpac`. |
| 43 | +- **DacVersion**: The version of the data-tier application `.dacpac`. The default value is `1.0.0.0`. |
| 44 | + |
| 45 | +### Default schema |
| 46 | + |
| 47 | +The `DefaultSchema` property sets the default schema for the SQL project. This property applies to 1-part named objects. The default value is `dbo`. |
| 48 | + |
| 49 | +### T-SQL warnings |
| 50 | + |
| 51 | +The `SuppressTSqlWarnings` and `TreatTSqlWarningsAsErrors` properties control how T-SQL warnings are handled during project build. The `SuppressTSqlWarnings` property suppresses T-SQL warnings during project build, specified as a comma-separated list of error numbers. |
| 52 | + |
| 53 | +The `TreatTSqlWarningsAsErrors` property treats T-SQL warnings as errors, causing any T-SQL warnings to fail the build. The default value for `TreatTSqlWarningsAsErrors` is `False`. |
| 54 | + |
| 55 | +## Example usage of project properties |
| 56 | + |
| 57 | +The following example shows how to set the `CompatibilityMode`, `IsChangeTrackingOn`, and `TreatTSqlWarningsAsErrors` properties in a SQL project file. The `CompatibilityMode` property is set to `130`, the `IsChangeTrackingOn` property is set to `True`, and the `TreatTSqlWarningsAsErrors` property is set to `True`. The `TreatSqlWarningsAsErrors` property is only set to `True` on the `Release` build configuration. |
| 58 | + |
| 59 | +```xml |
| 60 | +<?xml version="1.0" encoding="utf-8"?> |
| 61 | +<Project DefaultTargets="Build"> |
| 62 | + <Sdk Name="Microsoft.Build.Sql" Version="1.0.0-rc1" /> |
| 63 | + <PropertyGroup> |
| 64 | + <Name>AdventureWorks</Name> |
| 65 | + <DSP>Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider</DSP> |
| 66 | + <ModelCollation>1033, CI</ModelCollation> |
| 67 | + <ProjectGuid>{00000000-0000-0000-0000-000000000000}</ProjectGuid> |
| 68 | + <RunSqlCodeAnalysis>true</RunSqlCodeAnalysis> |
| 69 | + <CompatibilityMode>130</CompatibilityMode> |
| 70 | + <IsChangeTrackingOn>True</IsChangeTrackingOn> |
| 71 | + </PropertyGroup> |
| 72 | + <PropertyGroup Condition="'$(Configuration)'=='Release'"> |
| 73 | + <TreatTSqlWarningsAsErrors>True</TreatTSqlWarningsAsErrors> |
| 74 | + </PropertyGroup> |
| 75 | +</Project> |
| 76 | +``` |
| 77 | + |
| 78 | +## All project properties |
| 79 | + |
| 80 | +Some project properties are associated with database options that apply to only SQL Server databases or specific versions of SQL Server. Before including a project property in your project, review the associated documentation for the database option to understand the behavior of the property and database requirements. |
| 81 | + |
| 82 | +| Property | `DATABASE SET` option | UI label | SQL project default value | Allowed values | |
| 83 | +|---|---|---|---|---| |
| 84 | +| AllowSnapshotIsolation | `ALLOW_SNAPSHOT_ISOLATION` | Database settings, Operational, Allow snapshot isolation | False | {True|False} | |
| 85 | +| AnsiNulls| `ANSI_NULLS` | Database settings, SET ANSI_NULLS | True | {True|False} | |
| 86 | +| AnsiPadding | `ANSI_PADDING` | Database settings, SET ANSI_PADDING | True | {True|False} | |
| 87 | +| AnsiWarnings | `ANSI_WARNINGS` | Database settings, SET ANSI_WARNINGS | True | {True|False} | |
| 88 | +| ArithAbort | `ARITHABORT` | Database settings, SET ARITHABORT | True | {True|False} | |
| 89 | +| AutoClose | `AUTO_CLOSE` | Database settings, Operational, Auto close | False | {True|False} | |
| 90 | +| AutoCreateStatistics | `AUTO_CREATE_STATISTICS` | Database settings, Operational, Auto create statistics | True | {True|False} | |
| 91 | +| AutoShrink | `AUTO_SHRINK` | Database settings, Operational, Auto shrink | False | {True|False} | |
| 92 | +| AutoUpdateStatistics | `AUTO_UPDATE_STATISTICS` | Database settings, Operational, Auto update statistics | True | {True|False} | |
| 93 | +| ChangeTrackingRetentionPeriod | `CHANGE_RETENTION` | Database settings, Operational, Change tracking retention period | 2 | {integer} | |
| 94 | +| ChangeTrackingRetentionUnit | `CHANGE_RETENTION` | Database settings, Operational, Change tracking retention period | MINUTES | {DAYS|HOURS|MINUTES} | |
| 95 | +| CloseCursorOnCommitEnabled | `CURSOR_CLOSE_ON_COMMIT` | Database settings, Operational, Close cursor on commit enabled | False | {True|False} | |
| 96 | +| CompatibilityMode | `COMPATIBILITY_LEVEL` | Database settings, Compatibility level | | {100|110|120|130|140|150|160|170}<sup>1</sup> | |
| 97 | +| ConcatNullYieldsNull | `CONCAT_NULL_YIELDS_NULL` | Database settings, SET CONCAT_NULL_YIELDS_NULL | True | {True|False} | |
| 98 | +| Containment | `CONTAINMENT` | Database settings, Containment | NONE | {NONE|PARTIAL} | |
| 99 | +| DacApplicationName | | Data-tier application (`.dacpac`) properties, name | The project name | {string} | |
| 100 | +| DacDescription | | Data-tier application (`.dacpac`) properties, description | | {string} | |
| 101 | +| DacVersion | | Data-tier application (`.dacpac`) properties, version | 1.0.0.0 | {semantic version number} | |
| 102 | +| DatabaseAccess | `db_user_access_option` | Database settings, Database access | MULTI_USER | {MULTI_USER|SINGLE_USER|RESTRICTED_USER} | |
| 103 | +| DatabaseChaining | `DB_CHAINING` | Database settings, Database chaining | False | {True|False} | |
| 104 | +| DatabaseDefaultFulltextLanguage | `DEFAULT_FULLTEXT_LANGUAGE` | Database settings, Default fulltext language | 1033 | {integer [language id](../../../relational-databases/system-compatibility-views/sys-syslanguages-transact-sql.md)} | |
| 105 | +| DatabaseDefaultLanguage | `DEFAULT_LANGUAGE` | Database settings, Default language | 1033 | {integer [language id](../../../relational-databases/system-compatibility-views/sys-syslanguages-transact-sql.md)} | |
| 106 | +| DatabaseState | `db_state_option` | Database settings, Database state | ONLINE | {ONLINE|OFFLINE} | |
| 107 | +| DbScopedConfigLegacyCardinalityEstimation | `LEGACY_CARDINALITY_ESTIMATION`<sup>2</sup> | Database scoped configuration, Legacy cardinality estimation | Off | {Off|On} | |
| 108 | +| DbScopedConfigLegacyCardinalitySecondaryEstimation | `LEGACY_CARDINALITY_SECONDARY_ESTIMATION`<sup>2</sup> | Database scoped configuration, Legacy cardinality estimation for secondary | Primary | {Primary|Off|On} | |
| 109 | +| DbScopedConfigParameterSniffing | `PARAMETER_SNIFFING`<sup>2</sup> | Database scoped configuration, Parameter sniffing | On | {On|Off} | |
| 110 | +| DbScopedConfigParameterSniffingSecondary | `PARAMETER_SNIFFING_SECONDARY`<sup>2</sup> | Database scoped configuration, Parameter sniffing for secondary | Primary | {Primary|Off|On} | |
| 111 | +| DbScopedConfigOptimizerHotfixes | `OPTIMIZER_HOTFIXES`<sup>2</sup> | Database scoped configuration, Query optimizer hotfixes | Off | {Off|On} | |
| 112 | +| DbScopedConfigOptimizerHotfixesSecondary | `OPTIMIZER_HOTFIXES_SECONDARY`<sup>2</sup> | Database scoped configuration, Query optimizer hotfixes for secondary | Primary | {Primary|Off|On} | |
| 113 | +| DbScopedConfigMaxDOP | `MAXDOP`<sup>2</sup> | Database scoped configuration, Max degrees of parallelism | 0 | {integer} | |
| 114 | +| DbScopedConfigMaxDOPSecondary | `MAXDOP_SECONDARY`<sup>2</sup> | Database scoped configuration, Max degrees of parallelism for secondary | | {integer} | |
| 115 | +| DbScopedConfigDWCompatibilityLevel | `DW_COMPATIBILITY_LEVEL`<sup>2</sup> | Database scoped configuration, DW compatibility level | 0 | {0|10|20|30|40|50|9000}<sup>3</sup> | |
| 116 | +| DefaultCollation | `COLLATE`<sup>4</sup> | Database settings, Database collation | SQL_Latin1_General_CP1_CI_AS | See [SQL Server collation name](../../../t-sql/statements/sql-server-collation-name-transact-sql.md) for valid values. | |
| 117 | +| DefaultCursor | `CURSOR_DEFAULT` | Database settings, Operational, Default cursor | Local | {Global|Local} | |
| 118 | +| DefaultFilegroup | | Database settings, Operational, Default filegroup | PRIMARY | {string} | |
| 119 | +| DefaultFileStreamFilegroup | Database settings, Operational, Default filestream filegroup | | {string} | |
| 120 | +| DefaultSchema | | General project setting, default schema | dbo | {string} | |
| 121 | +| DelayedDurability | `DELAYED_DURABILITY` | Database settings, Operational, Transactions delayed durability | DISABLED | {DISABLED|ALLOWED|FORCED} | |
| 122 | +| DSP | | The [target platform](target-platform.md) for the SQL project | | See [target platform](target-platform.md) for valid values. | |
| 123 | +| EnableFullTextSearch | | Database settings, Enable full text search | True | {True|False} | |
| 124 | +| FileStreamDirectoryName | `FILESTREAM` (`DIRECTORY_NAME`) | Database settings, FILESTREAM directory name | | {string} | |
| 125 | +| IsBrokerPriorityHonored | `HONOR_BROKER_PRIORITY` | Database settings, Broker priority honored | False | {True|False} | |
| 126 | +| IsChangeTrackingAutoCleanupOn | `CHANGE_TRACKING` | Database settings, Operational, Change tracking auto cleanup | True | {True|False} | |
| 127 | +| IsChangeTrackingOn | `CHANGE_TRACKING` | Database settings, Operational, Change tracking | False | {True|False} | |
| 128 | +| IsEncryptionOn | `ENCRYPTION` | Database settings, Encryption enabled | False | {True|False} | |
| 129 | +| IsLedgerOn | `LEDGER`<sup>4</sup> | Database settings, Enable Ledger | False | {True|False} | |
| 130 | +| IsNestedTriggersOn | `NESTED_TRIGGERS` | Database settings, Nested triggers enabled | True | {True|False} | |
| 131 | +| IsTransformNoiseWordsOn | `TRANSFORM_NOISE_WORDS` | Database settings, Transform noise words | False | {True|False} | |
| 132 | +| MemoryOptimizedElevateToSnapshot | `MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT` | Database settings, Operational, Memory optimized elevate to snapshot | False | {True|False} | |
| 133 | +| ModelCollation | | Project settings, Collation | 1033,CI | {integer [language id](../../../relational-databases/system-compatibility-views/sys-syslanguages-transact-sql.md)}, {CI|CS} | |
| 134 | +| NonTransactedFileStreamAccess | `NON_TRANSACTED_ACCESS` | Database settings, FILESTREAM non-transacted access | OFF | {OFF|READ_ONLY|FULL} | |
| 135 | +| NumericRoundAbort | `NUMERIC_ROUNDABORT` | Database settings, SET NUMERIC_ROUNDABORT | False | {True|False} | |
| 136 | +| OutputPath | | Build settings, Output path | `bin\Debug` and `bin\Release` | {string} | |
| 137 | +| PageVerify | `PAGE_VERIFY` | Database settings, Operational, Page verify | NONE | {NONE|TORN_PAGE_DETECTION|CHECKSUM} | |
| 138 | +| Parameterization | `PARAMETERIZATION` | Database settings, Parameterization | SIMPLE | {SIMPLE|FORCED} | |
| 139 | +| QueryStoreCaptureMode | `QUERY_STORE` (`QUERY_CAPTURE_MODE`) | Database settings, Operational, Query store capture mode | ALL | {OFF|ALL|AUTO} | |
| 140 | +| QueryStoreDesiredState | `QUERY_STORE` (`OPERATION_MODE`) | Database settings, Operational, Query store operation mode | OFF | {OFF|READ_WRITE|READ_ONLY} | |
| 141 | +| QueryStoreFlushInterval | `QUERY_STORE` (`DATA_FLUSH_INTERVAL_SECONDS`) | Database settings, Operational, Query store data flush interval (seconds) | 900 | {integer} | |
| 142 | +| QueryStoreIntervalLength | `QUERY_STORE` (`INTERVAL_LENGTH_MINUTES`) | Database settings, Operational, Query store interval length (minutes) | 60 | {integer} | |
| 143 | +| QueryStoreMaxPlansPerQuery | `QUERY_STORE` (`MAX_PLANS_PER_QUERY`) | Database settings, Operational, Query store max plans per query | 200 | {integer} | |
| 144 | +| QueryStoreMaxStorageSize | `QUERY_STORE` (`MAX_STORAGE_SIZE_MB`) | Database settings, Operational, Query store max storage size (MB) | 100 | {integer} | |
| 145 | +| QueryStoreStaleQueryThreshold | `QUERY_STORE` (`STALE_QUERY_THRESHOLD_DAYS`) | Database settings, Operational, Query store stale query threshold (days) | 367 | {integer} | |
| 146 | +| QuotedIdentifier | `QUOTED_IDENTIFIER` | Database settings, SET QUOTED_IDENTIFIER | True | {True|False} | |
| 147 | +| ReadCommittedSnapshot | `READ_COMMITTED_SNAPSHOT` | Database settings, Operational, Read committed snapshot | False | {True|False} | |
| 148 | +| Recovery | `RECOVERY` | Database settings, Operational, Recovery | FULL | {FULL|SIMPLE|BULK_LOGGED} | |
| 149 | +| RecursiveTriggersEnabled | `RECURSIVE_TRIGGERS` | Database settings, Recursive triggers enabled | False | {True|False} | |
| 150 | +| ServiceBrokerOption | `SERVICE_BROKER` | Database settings, Service broker options | DisableBroker | {DisableBroker|EnableBroker|NewBroker|ErrorBrokerConversations} | |
| 151 | +| SuppressTSqlWarnings | | Build settings, Suppress T-SQL warnings (comma-separated list of T-SQL warning codes) | | {string} | |
| 152 | +| TargetRecoveryTimePeriod | Database settings, Operational, target recovery time (seconds) | Specifies the frequency of indirect checkpoints on a per-database basis. | 60 | {integer} | |
| 153 | +| TargetRecoveryTimeUnit | | Database settings, Operational, target recorder time | SECONDS | {MINUTES|SECONDS} | |
| 154 | +| TreatTSqlWarningsAsErrors | | Build settings, Treat T-SQL warnings as errors | False | {True|False} | |
| 155 | +| Trustworthy | `TRUSTWORTHY` | Database settings, Trustworthy | False | {True|False} | |
| 156 | +| TwoDigitYearCutoff | `TWO_DIGIT_YEAR_CUTOFF` | Database settings, Two digit year cutoff | 2049 | {integer} | |
| 157 | +| UpdateOptions | `db_update_option` | Database settings, Update options | READ_WRITE | {READ_WRITE|READ_ONLY} | |
| 158 | +| ValidateCasingOnIdentifiers | | General project setting, validate the casing of identifiers | True | {True|False} | |
| 159 | + |
| 160 | +1. The default value differs based on engine edition and server settings. |
| 161 | +1. [Database scoped configuration](../../../t-sql/statements/alter-database-scoped-configuration-transact-sql.md) options. |
| 162 | +1. AUTO is set with the 0 value. |
| 163 | +1. Applies as a `CREATE DATABASE` [option](../../../t-sql/statements/create-database-transact-sql.md) only. |
| 164 | + |
| 165 | +## Related content |
| 166 | + |
| 167 | +- [Target platform overview](target-platform.md) |
| 168 | +- [SQL code analysis to improve code quality](sql-code-analysis/sql-code-analysis.md) |
| 169 | +- [SQL projects tools](../sql-projects-tools.md) |
| 170 | +- [ALTER DATABASE SET options (Transact-SQL)](../../../t-sql/statements/alter-database-transact-sql-set-options.md) |
0 commit comments