SA0073B : Check all User-Defined Types for following specified naming convention |
![]() |
Inconsistent or unclear user-defined types naming can lead to confusion and maintenance challenges.

In T-SQL scripts, user-defined types are created using the CREATE TYPE statement. A major problem arises when the naming conventions for these types are inconsistent or unclear, which can lead to confusion, increased error rates, and difficulties in database management.
For example:
1-- Poor naming practice for user-defined type 2CREATE TYPE abc123 AS TABLE (...);
This example uses a non-descriptive name that does not convey the type’s purpose or content, complicating schema reviews and future maintenance efforts.
-
Unclear names make it difficult for developers and administrators to understand the database’s schema, especially in large or complex systems.
-
Inconsistent naming can lead to increased cognitive load and errors during development, as team members may misinterpret or misuse types.
`

Ensure consistent and meaningful naming for user-defined types in SQL to improve maintainability and clarity.
Follow these steps to address the issue:
-
Review the existing object name in the CREATE TYPE statement.
-
Refer to your organization’s naming conventions for database objects to identify the appropriate format and structure for the type name.
-
Rename the type using a descriptive and consistent name that clearly indicates its purpose and content.
-
Update any database scripts or application code that reference the renamed type to ensure consistency in the database schema.
For example:
1-- Original poorly named user-defined type 2CREATE TYPE abc123 AS TABLE ( 3 Column1 INT, 4 Column2 VARCHAR(50) 5); 6 7-- Corrected with a meaningful name following naming conventions 8CREATE TYPE OrderItemTableType AS TABLE ( 9 ItemID INT, 10 ItemDescription VARCHAR(50) 11);

The rule has a Batch scope and is applied only on the SQL script.

Name | Description | Default Value |
---|---|---|
NamePattern |
Deault constraint name pattern. |
regexp:[A-Z][A-Za-z]+ |

The rule does not need Analysis Context or SQL Connection.


Naming Rules, Code Smells

There is no additional info for this rule.

SQL
1CREATE TYPE SSN 2FROM varchar(11) NOT NULL ; 3 4CREATE TYPE Utf8String 5EXTERNAL NAME utf8string.[Microsoft.Samples.SqlServer.utf8string] ; 6 7CREATE TYPE LocationTableType AS TABLE 8 ( LocationName VARCHAR(50) 9 , CostRate INT ); |

Message | Line | Column | |
---|---|---|---|
1 | SA0073B : The user defined type name Utf8String does not match the naming convention. The expected name is [[A-Z][A-Za-z]+]. | 4 | 12 |
