Skip to content

Commit 44801ec

Browse files
20260330 database identifiers edit pass
1 parent fbe654a commit 44801ec

1 file changed

Lines changed: 6 additions & 41 deletions

File tree

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

Lines changed: 6 additions & 41 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,7 +19,7 @@ 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
@@ -39,42 +39,7 @@ CREATE TABLE TableX (
3939

4040
This table also has an unnamed constraint. The `PRIMARY KEY` constraint has no identifier.
4141

42-
Some identifiers, such as constraint names and other schema-scoped objects, must be unique within a database schema. For example, two primary key constraints in the same schema can't share a name, so the second table creation statement isn't allowed:
43-
44-
```sql
45-
USE AdventureWorks2022;
46-
GO
47-
48-
CREATE TABLE [SalesOrderGeneral Table] (
49-
[Order] INT NOT NULL,
50-
[SalesOrderID] INT IDENTITY(1, 1) NOT NULL,
51-
[SalesOrderDetailID] INT NOT NULL,
52-
[ModifiedDate] DATETIME NOT NULL,
53-
CONSTRAINT [PK_SalesOrder] PRIMARY KEY CLUSTERED (
54-
[Order] ASC,
55-
[SalesOrderID] ASC
56-
)
57-
);
58-
GO
59-
60-
-- Primary key identifier conflicts with existing primary key, and so will result in an error.
61-
CREATE TABLE [SalesOrderDetail Table] (
62-
[Order] INT NOT NULL,
63-
[SalesOrderDetailID] INT IDENTITY(1, 1) NOT NULL,
64-
[OrderQty] SMALLINT NOT NULL,
65-
[ProductID] INT NOT NULL,
66-
[UnitPrice] MONEY NOT NULL,
67-
[UnitPriceDiscount] MONEY NOT NULL,
68-
[ModifiedDate] DATETIME NOT NULL,
69-
CONSTRAINT [PK_SalesOrder] PRIMARY KEY CLUSTERED (
70-
[Order] ASC,
71-
[SalesOrderDetailID] ASC
72-
)
73-
);
74-
GO
75-
```
76-
77-
However, each table can contain its own column named `Order`, because column names only need to be unique within each table, not within the schema.
42+
Some identifiers, such as 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.
7843

7944
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.
8045

@@ -162,7 +127,7 @@ The names of variables, functions, and stored procedures must comply with the fo
162127

163128
1. Embedded spaces or special characters aren't allowed.
164129

165-
1. [Supplementary characters](../../relational-databases/collations/collation-and-unicode-support.md#Supplementary_Characters) aren't allowed.
130+
1. [Supplementary characters](../collations/collation-and-unicode-support.md#Supplementary_Characters) aren't allowed.
166131

167132
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.
168133

0 commit comments

Comments
 (0)