Click or drag to resize

SA0230 : Identifier uses different case than object's actual name

The topic describes the SA0230 analysis rule.

Message

Identifier uses different case than object's actual name

Description

The rule checks T-SQL code for reference of database object or column having different case than its actual name.

Using inconsistent identifier case will break the code if deployed on case sensitive database or server instance.

Scope

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

Parameters

Rule has no parameters.

Remarks

The rule requires SQL Connection. If there is no connection provided, the rule will be skipped during analysis.

Categories

Naming Rules, New Rules

Additional Information

There is no additional info for this rule.

Example Test Script
SQL
 1CREATE PROCEDURE [HumanResourceS].[uspUpdateEmployeeHireInfo]
 2@BusinessEntityID [int], 
 3@JobTitle [nvarchar](50), 
 4@HireDate [datetime], 
 5@RateChangeDate [datetime], 
 6@Rate [money], 
 7@PayFrequency [tinyint], 
 8@CurrentFlag [dbo].[Flag] 
 9WITH EXECUTE AS CALLER
10AS
11BEGIN
12        SET NOCOUNT ON;
13        BEGIN TRY
14                BEGIN TRANSACTION;
15                UPDATE [HumanResources].[EmployeE] 
16                SET [JobTitle] = @JobTitle 
17                ,[HireDate] = @HireDate 
18                ,[CurrentFlag] = @CurrentFlag 
19                WHERE [BusinessEntityId] = @BusinessEntityID;
20                INSERT INTO [HumanResources].[EmployeePayHistory] 
21                ([BusinessEntityID]
22                ,[RateChangeDate]
23                ,[Rate]
24                ,[Payfrequency]) 
25                VALUES (@BusinessEntityID, @RateChangeDate, @Rate, @PayFrequency);
26                COMMIT TRANSACTION;
27        END TRY
28        BEGIN CATCH
29                IF @@TRANCOUNT > 0
30                BEGIN
31                ROLLBACK TRANSACTION;
32                END
33                EXECUTE [dbo].[UspLogError];
34        END CATCH;
35END;

Analysis Results

 MessageLineColumn
1SA0230 : The case of the identifier [HumanResourceS].[uspUpdateEmployeeHireInfo] does not match the real stored procedure name [HumanResources].[uspUpdateEmployeeHireInfo].117
2SA0230 : The case of the identifier [HumanResources].[EmployeE] does not match the real table name [HumanResources].[Employee].159
3SA0230 : The case of the identifier [BusinessEntityId] does not match the real column name [BusinessEntityID].198
4SA0230 : The case of the identifier [Payfrequency] does not match the real column name [PayFrequency].243
5SA0230 : The case of the identifier [dbo].[UspLogError] does not match the real stored procedure name [dbo].[uspLogError].3310
See Also

Other Resources