The topic describes the DF190 T-SQL code analysis rule.
BEST PRACTICE
No nullability constraint is specified for table column.
It is recommended to explicitly specify the nullability of table columns when creating a table, declaring a temporary table, or defining a table variable.
By following this rule, you provide clarity about the expected behavior of the columns regarding null values, which enhances the understanding of the table structure and facilitates data integrity. Additionally, explicitly defining nullability helps prevent potential errors and inconsistencies in data manipulation operations.
CREATE TABLE dbo.DemoTable(Code VARCHAR(128))
GO
CREATE TABLE dbo.DemoTable(Code VARCHAR(128) NULL)
GO
CREATE TABLE dbo.DemoTable(Code VARCHAR(128) NOT NULL)
GO