SA0269 : Datatype identifier is not in the required case

The topic describes the SA0269 analysis rule.

Message

Datatype identifier is not in the required case

Description

The rule checks T-SQL code for datatype identifiers which do not use the required keyword case.

The parameter RequiredCase specifies the datatype identifier case.

How to fix

Change the case of the datatype identifier to the case configured by the RequiredCase parameter.

Scope

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

Parameters
Name Description Default Value
RequiredCase

The parameter specifies the required case of the reserved keywords.

lowercase

Remarks

The rule does not need Analysis Context or SQL Connection.

Effort To Fix
2 minutes per issue.
Categories

Naming Rules, Code Smells

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
 1CREATE TABLE Test.Greeting
 2(
 3GreetingId [INT] identity (1,1) PRIMARY KEY,
 4Message [nvarchar](255) NOT NULL,
 5)
 6
 7CREATE TABLE Test.Greeting1
 8(
 9GreetingId int identity (1,1) PRIMARY KEY,
10Message nvarchar(255) NOT NULL,
11)
12
13CREATE TABLE Test.Greeting2
14(
15GreetingId Int identity (1,1) PRIMARY KEY,
16Message nvarChar(255) NOT NULL,
17)
18
19CREATE TABLE Test.Greeting1
20(
21GreetingId INT identity (1,1) PRIMARY KEY,
22Message NVARCHAR(255) NOT NULL,
23)

Example Test SQL with Automatic Fix
SQL
 1CREATE TABLE Test.Greeting
 2(
 3GreetingId [int] identity (1,1) PRIMARY KEY,
 4Message [nvarchar](255) NOT NULL,
 5)
 6
 7CREATE TABLE Test.Greeting1
 8(
 9GreetingId int identity (1,1) PRIMARY KEY,
10Message nvarchar(255) NOT NULL,
11)
12
13CREATE TABLE Test.Greeting2
14(
15GreetingId int identity (1,1) PRIMARY KEY,
16Message nvarchar(255) NOT NULL,
17)
18
19CREATE TABLE Test.Greeting1
20(
21GreetingId int identity (1,1) PRIMARY KEY,
22Message nvarchar(255) NOT NULL,
23)

Analysis Results
  Message Line Column
1 SA0269 : Datatype identifier is not in the required case. 3 11
2 SA0269 : Datatype identifier is not in the required case. 15 11
3 SA0269 : Datatype identifier is not in the required case. 16 8
4 SA0269 : Datatype identifier is not in the required case. 21 11
5 SA0269 : Datatype identifier is not in the required case. 22 8
See Also

Other Resources