SA0259 : The created object already exists

The topic describes the SA0259 analysis rule.

Message

The created object already exists

Description

The rule checks T-SQL code for CREATE statements of databases, schemas, procedures, views, functions, triggers, tables and indexes, and reports in case the created objects already exist.

NOTE: The rule ignores CREATE OR ALTER statements.

How to fix

Check for object existence before crating it, or use CREATE OR ALTER statements for stored procedures, functions, triggers and views instead of sole CREATE statement.

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.

Effort To Fix
5 minutes per issue.
Categories

Design Rules, Bugs

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
1CREATE TABLE [Person].[Person]
2(
3        Column1 [int] NOT NULL
4)

Analysis Results
  Message Line Column
1 SA0259 : The created table already exists. 1 22
See Also

Other Resources