SA0244 : Database object created,altered or dropped without specifiying schema name

The topic describes the SA0244 analysis rule.

Message

Database object created,altered or dropped without specifiying schema name

Description

The rule checks T-SQL code for CREATE,ALTER and DROP statements of schema bound objects, which miss the schema name of the object.

It is recommended to fully qualify the target object name in CREATE,ALTER and DROP statements.

When not schema name is specified, the default schema of the current user is assumed.

How to fix

Use fully qualified name for the target object in CREATE,ALTER and DROP statements.

Scope

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

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Effort To Fix
5 minutes per issue.
Categories

Design 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 Greeting
 8(
 9GreetingId INT IDENTITY (1,1) PRIMARY KEY,
10Message nvarchar(255) NOT NULL,
11)
12DROP TABLE greeting;
13
14DROP TABLE #tempTable1;

Analysis Results
  Message Line Column
1 SA0244 : The table is created without specifiying schema name. 7 13
2 SA0244 : The table is dropped without specifiying schema name. 12 11
See Also

Other Resources