The topic describes the DF038 T-SQL code analysis rule.
NAMING CONVENTIONS
The constraint name is not explicitly specified.
To facilitate database maintenance, it is recommended to explicitly name constraints so that they can be easily referenced when needed.
When the constraint name is not explicitly specified in SQL, the DBMS automatically generates a default name for the constraint, typically combining the table name with a system-generated identifier. This can lead to less readable and harder-to-manage schema definitions, making tasks like error resolution and constraint modification more challenging due to the non-descriptive and unpredictable default names.
CREATE TABLE dbo.Customers(
CustomerId INT PRIMARY KEY CLUSTERED,
CustomerName VARCHAR(255) NOT NULL
);
CREATE TABLE dbo.Customers(
CustomerId INT CONSTRAINT PK_Customers PRIMARY KEY CLUSTERED,
CustomerName VARCHAR(255) NOT NULL
);