Skip to content

Commit 1ebaf97

Browse files
authored
Merge pull request #36971 from WilliamDAssafMSFT/20260330-database-identifiers
20260330 database identifiers
2 parents 6d807bc + e614bad commit 1ebaf97

4 files changed

Lines changed: 31 additions & 40 deletions

File tree

azure-sql/database/elastic-pool-manage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ To create and manage SQL Database elastic pools and pooled databases, use these
113113

114114
## Related content
115115

116-
- To learn more about design patterns for SaaS applications using elastic pools, see [Design Patterns for Multi-tenant SaaS Applications with Azure SQL Database](saas-tenancy-app-design-patterns.md).
116+
- To learn more about design patterns for SaaS applications using elastic pools, see [Design Patterns for multitenant SaaS Applications with Azure SQL Database](saas-tenancy-app-design-patterns.md).

azure-sql/database/elastic-scale-shard-map-management.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ For a single-tenant model, create a **list-mapping** shard map. The single-tenan
3939

4040
:::image type="content" source="media/elastic-scale-shard-map-management/listmapping.png" alt-text="Diagram of List mapping.":::
4141

42-
The multi-tenant model assigns several tenants to an individual database (and you can distribute groups of tenants across multiple databases). Use this model when you expect each tenant to have small data needs. In this model, assign a range of tenants to a database using **range mapping**.
42+
The multitenant model assigns several tenants to an individual database (and you can distribute groups of tenants across multiple databases). Use this model when you expect each tenant to have small data needs. In this model, assign a range of tenants to a database using **range mapping**.
4343

4444
:::image type="content" source="media/elastic-scale-shard-map-management/rangemapping.png" alt-text="Diagram of Range mapping.":::
4545

46-
Or you can implement a multi-tenant database model using a *list mapping* to assign multiple tenants to an individual database. For example, DB1 is used to store information about tenant ID 1 and 5, and DB2 stores data for tenant 7 and tenant 10.
46+
Or you can implement a multitenant database model using a *list mapping* to assign multiple tenants to an individual database. For example, DB1 is used to store information about tenant ID 1 and 5, and DB2 stores data for tenant 7 and tenant 10.
4747

4848
:::image type="content" source="media/elastic-scale-shard-map-management/multipleonsingledb.png" alt-text="Diagram of Multiple tenants on single DB.":::
4949

azure-sql/database/saas-tenancy-app-design-patterns.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The vendor can access all the databases in all the standalone app instances, eve
8080

8181
This next pattern uses a multitenant application with many databases, all being single-tenant databases. A new database is provisioned for each new tenant. The application tier is scaled *up* vertically by adding more resources per node. Or the app is scaled *out* horizontally by adding more nodes. The scaling is based on workload, and is independent of the number or scale of the individual databases.
8282

83-
:::image type="content" source="media/saas-tenancy-app-design-patterns/saas-multi-tenant-app-database-per-tenant.png" alt-text="Diagram of the design of a multi-tenant app with database-per-tenant.":::
83+
:::image type="content" source="media/saas-tenancy-app-design-patterns/saas-multi-tenant-app-database-per-tenant.png" alt-text="Diagram of the design of a multitenant app with database-per-tenant.":::
8484

8585
### Customize for a tenant
8686

@@ -92,7 +92,7 @@ With database-per-tenant, customizing the schema for one or more individual tena
9292

9393
When databases are deployed in the same resource group, they can be grouped into elastic pools. The pools provide a cost-effective way of sharing resources across many databases. This pool option is cheaper than requiring each database to be large enough to accommodate the usage peaks that it experiences. Even though pooled databases share access to resources they can still achieve a high degree of performance isolation.
9494

95-
:::image type="content" source="media/saas-tenancy-app-design-patterns/saas-multi-tenant-app-database-per-tenant-pool.png" alt-text="Diagram of the design of multi-tenant app with database-per-tenant, using elastic pool.":::
95+
:::image type="content" source="media/saas-tenancy-app-design-patterns/saas-multi-tenant-app-database-per-tenant-pool.png" alt-text="Diagram of the design of multitenant app with database-per-tenant, using elastic pool.":::
9696

9797
Azure SQL Database provides the tools necessary to configure, monitor, and manage the sharing. Both pool-level and database-level performance metrics are available in the Azure portal, and through Azure Monitor logs. The metrics can give great insights into both aggregate and tenant-specific performance. Individual databases can be moved between pools to provide reserved resources to a specific tenant. These tools enable you to ensure good performance in a cost effective manner.
9898

@@ -141,7 +141,7 @@ Management operations that are focused on individual tenants are more complex to
141141

142142
Most SaaS applications access the data of only one tenant at a time. This access pattern allows tenant data to be distributed across multiple databases or shards, where all the data for any one tenant is contained in one shard. Combined with a multitenant database pattern, a sharded model allows almost limitless scale.
143143

144-
:::image type="content" source="media/saas-tenancy-app-design-patterns/saas-multi-tenant-app-sharded-multi-tenant-databases.png" alt-text="Diagram of the design of a multi-tenant app with sharded multi-tenant databases.":::
144+
:::image type="content" source="media/saas-tenancy-app-design-patterns/saas-multi-tenant-app-sharded-multi-tenant-databases.png" alt-text="Diagram of the design of a multitenant app with sharded multitenant databases.":::
145145

146146
### Manage shards
147147

docs/relational-databases/databases/database-identifiers.md

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: Database identifiers
3-
description: "Get acquainted with database identifiers. Learn about their collation, various classes, delimiting requirements, and naming rules."
2+
title: Database Identifiers
3+
description: Get acquainted with database identifiers. Learn about their collation, various classes, delimiting requirements, and naming rules.
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: randolphwest
7-
ms.date: 08/06/2024
7+
ms.date: 03/30/2026
88
ms.service: sql
99
ms.subservice: configuration
1010
ms.topic: concept-article
@@ -19,16 +19,18 @@ helpviewer_keywords:
1919
- "Transact-SQL identifiers"
2020
- "database objects [SQL Server], names"
2121
dev_langs:
22-
- "TSQL"
22+
- TSQL
2323
monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric || =fabric-sqldb"
2424
---
2525
# Database identifiers
2626

2727
[!INCLUDE [SQL Server Azure SQL Database Synapse Analytics PDW FabricSE FabricDW FabricSQLDB](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb.md)]
2828

29-
The database object name is referred to as its identifier. Everything in [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] can have an identifier. Servers, databases, and database objects, such as tables, views, columns, indexes, triggers, procedures, constraints, and rules, can have identifiers. Identifiers are required for most objects, but are optional for some objects such as constraints.
29+
The database object name is referred to as its identifier.
3030

31-
An object identifier is created when the object is defined. The identifier is then used to reference the object. For example, the following statement creates a table with the identifier `TableX`, and two columns with the identifiers `KeyCol` and `Description`:
31+
Servers, databases, and database objects, such as tables, views, columns, indexes, triggers, procedures, constraints, and rules, can have identifiers. Most objects require identifiers, but some objects, such as constraints, make them optional.
32+
33+
You create an object identifier when you define the object. Use the identifier to reference the object. For example, the following statement creates a table with the identifier `TableX`, and two columns with the identifiers `KeyCol` and `Description`:
3234

3335
```sql
3436
CREATE TABLE TableX (
@@ -37,9 +39,14 @@ CREATE TABLE TableX (
3739
);
3840
```
3941

40-
This table also has an unnamed constraint. The `PRIMARY KEY` constraint has no identifier.
42+
This table also has an unnamed constraint. The primary key constraint has no identifier, and so would be assigned a system-generated name like `PK__TableX__D7CB9CCCEEF0806C`, which you could observe in system metadata views like `sys.key_constraints`.
43+
44+
Constraint names and other schema-scoped objects must be unique within a database schema. For example, two primary key constraints can't share a name. However, column names only need to be unique within each table, not within the schema.
45+
46+
The collation of an identifier depends on the level at which you define it.
4147

42-
The collation of an identifier depends on the level at which it's defined. Identifiers of instance-level objects, such as logins and database names, are assigned the default collation of the instance. Identifiers of objects in a database, such as tables, views, and column names, are assigned the default collation of the database. For example, two tables with names that differ only in case can be created in a database that has case-sensitive collation, but can't be created in a database that has case-insensitive collation.
48+
- The default collation of the instance is assigned to identifiers of instance-level objects, such as logins and database names.
49+
- The default collation of the database is assigned to identifiers of objects in a database, such as tables, views, and column names. For example, you can create two tables with names that differ only in case in a database that has case-sensitive collation, but you can't create them in a database that has case-insensitive collation.
4350

4451
> [!NOTE]
4552
> The names of variables, or the parameters of functions and stored procedures must comply with the rules for [!INCLUDE [tsql](../../includes/tsql-md.md)] identifiers.
@@ -101,17 +108,17 @@ Both regular and delimited identifiers must contain from 1 through 128 character
101108

102109
## Rules for regular identifiers
103110

104-
The names of variables, functions, and stored procedures must comply with the following rules for [!INCLUDE [tsql](../../includes/tsql-md.md)] identifiers.
111+
The names of variables, functions, and stored procedures must follow these rules for [!INCLUDE [tsql](../../includes/tsql-md.md)] identifiers.
105112

106-
1. The first character must be one of the following items:
113+
1. The first character must be one of the following characters:
107114

108115
- A letter as defined by the Unicode Standard 3.2. The Unicode definition of letters includes Latin characters from `a` through `z`, from `A` through `Z`, and also letter characters from other languages.
109116

110117
- The underscore (`_`), at sign (`@`), or number sign (`#`).
111118

112119
Certain symbols at the beginning of an identifier have special meaning in [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)]. A regular identifier that starts with the at sign always denotes a local variable or parameter and can't be used as the name of any other type of object. An identifier that starts with a number sign denotes a temporary table or procedure. An identifier that starts with double number signs (`##`) denotes a global temporary object. Although the number sign or double number sign characters can be used to begin the names of other types of objects, we don't recommend this practice.
113120

114-
Some [!INCLUDE [tsql](../../includes/tsql-md.md)] functions have names that start with double at signs (`@@`). To avoid confusion with these functions, you shouldn't use names that start with `@@`.
121+
Some [!INCLUDE [tsql](../../includes/tsql-md.md)] functions have names that start with double at signs (`@@`). To avoid confusion with these functions, don't use names that start with `@@`.
115122

116123
1. Subsequent characters can include the following list:
117124

@@ -121,42 +128,26 @@ The names of variables, functions, and stored procedures must comply with the fo
121128

122129
- The at sign (`@`), dollar sign (`$`), number sign (`#`), or underscore (`_`).
123130

124-
1. The identifier must not be a [!INCLUDE [tsql](../../includes/tsql-md.md)] reserved word. [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] reserves both the uppercase and lowercase versions of reserved words. When identifiers are used in [!INCLUDE [tsql](../../includes/tsql-md.md)] statements, the identifiers that don't comply with these rules must be delimited by double quotation marks or brackets. The words that are reserved depend on the database compatibility level. This level can be set by using the [ALTER DATABASE compatibility level](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md) statement.
131+
1. The identifier must not be a [!INCLUDE [tsql](../../includes/tsql-md.md)] reserved word. [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] reserves both the uppercase and lowercase versions of reserved words. When you use identifiers in [!INCLUDE [tsql](../../includes/tsql-md.md)] statements, delimit identifiers that don't comply with these rules by using double quotation marks or brackets. The words that are reserved depend on the database compatibility level. Set the database compatibility level by using the [ALTER DATABASE compatibility level](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md) statement.
125132

126-
1. Embedded spaces or special characters aren't allowed.
133+
1. Don't use embedded spaces or special characters.
127134

128-
1. [Supplementary characters](../../relational-databases/collations/collation-and-unicode-support.md#Supplementary_Characters) aren't allowed.
135+
1. Don't use [Supplementary characters](../collations/collation-and-unicode-support.md#Supplementary_Characters).
129136

130-
When identifiers are used in [!INCLUDE [tsql](../../includes/tsql-md.md)] statements, the identifiers that don't comply with these rules must be delimited by double quotation marks or brackets.
137+
When you use identifiers in [!INCLUDE [tsql](../../includes/tsql-md.md)] statements, delimit identifiers that don't comply with these rules by using double quotation marks or brackets.
131138

132-
> [!NOTE]
133-
> Some rules for the format of regular identifiers depend on the database compatibility level. This level can be set by using [ALTER DATABASE compatibility level](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md).
139+
Some rules for the format of regular identifiers depend on the database compatibility level.
134140

135141
## Catalog collation in Azure SQL Database
136142

137-
You can't change or set the logical server collation on Azure SQL Database. However, you can configure each database's collations separately for data in the database and for catalog. The catalog collation determines the collation for system metadata, such as object identifiers. Both collations can be specified independently when you [create the database in the Azure portal](/azure/azure-sql/database/single-database-create-quickstart?view=azuresql&preserve-view=true&tabs=azure-portal#create-a-single-database), in T-SQL with [CREATE DATABASE](../../t-sql/statements/create-database-transact-sql.md?view=azuresqldb-current&preserve-view=true#collation_name), in PowerShell with [New-AzSqlDatabase](/powershell/module/az.sql/new-azsqldatabase).
143+
You can't change or set the logical server collation on Azure SQL Database. However, you can configure each database's collations separately for data in the database and for catalog. The catalog collation determines the collation for system metadata, such as object identifiers. You can specify both collations independently when you [create the database in the Azure portal](/azure/azure-sql/database/single-database-create-quickstart?view=azuresql&preserve-view=true&tabs=azure-portal#create-a-single-database), in T-SQL with [CREATE DATABASE](../../t-sql/statements/create-database-transact-sql.md?view=azuresqldb-current&preserve-view=true#collation_name), or in PowerShell with [New-AzSqlDatabase](/powershell/module/az.sql/new-azsqldatabase).
138144

139145
For details and examples, see [CREATE DATABASE](../../t-sql/statements/create-database-transact-sql.md?view=azuresqldb-current&preserve-view=true#collation_name). Specify a collation for the database (`COLLATE`) and a catalog collation for system metadata and object identifiers (`CATALOG_COLLATION`).
140146

141147
## Catalog collation in SQL database in Microsoft Fabric
142148

143-
You can't change or set the logical server collation on SQL database in Fabric.
144-
145-
Currently, by default the collation of a SQL database in Fabric is `SQL_Latin1_General_CP1_CI_AS` and can't be updated. Collations on individual columns are supported.
149+
Currently, by default the collation of a SQL database in Fabric is `SQL_Latin1_General_CP1_CI_AS`, but this can be configured when deploying. The collation can't be updated after deployment. Collations on individual columns are supported. For more information on deployment options, see [Options to create a SQL database in Fabric](/fabric/database/sql/create-options).
146150

147151
## Related content
148152

149-
- [ALTER TABLE (Transact-SQL)](../../t-sql/statements/alter-table-transact-sql.md)
150-
- [CREATE DATABASE](../../t-sql/statements/create-database-transact-sql.md)
151-
- [CREATE DEFAULT (Transact-SQL)](../../t-sql/statements/create-default-transact-sql.md)
152-
- [CREATE PROCEDURE (Transact-SQL)](../../t-sql/statements/create-procedure-transact-sql.md)
153-
- [CREATE RULE (Transact-SQL)](../../t-sql/statements/create-rule-transact-sql.md)
154-
- [CREATE TABLE (Transact-SQL)](../../t-sql/statements/create-table-transact-sql.md)
155-
- [CREATE TRIGGER (Transact-SQL)](../../t-sql/statements/create-trigger-transact-sql.md)
156-
- [CREATE VIEW (Transact-SQL)](../../t-sql/statements/create-view-transact-sql.md)
157-
- [DECLARE @local_variable (Transact-SQL)](../../t-sql/language-elements/declare-local-variable-transact-sql.md)
158-
- [DELETE (Transact-SQL)](../../t-sql/statements/delete-transact-sql.md)
159-
- [INSERT (Transact-SQL)](../../t-sql/statements/insert-transact-sql.md)
160153
- [Reserved Keywords (Transact-SQL)](../../t-sql/language-elements/reserved-keywords-transact-sql.md)
161-
- [SELECT (Transact-SQL)](../../t-sql/queries/select-transact-sql.md)
162-
- [UPDATE (Transact-SQL)](../../t-sql/queries/update-transact-sql.md)

0 commit comments

Comments
 (0)