EX0019 : Find references to non-existing objects and columns

The topic describes the EX0019 analysis rule.

Message

Find references to non-existing objects and columns

Description

[Beta]The rule checks T-SQL code and reports occurrences of references to non-existing objects and columns.

NOTE: Due to The rule currently being in preview there could be some false positives reported.

How to fix

Scope

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

Parameters
Name Description Default Value
IgnoreTemporaryTables

The parameter specifies if to ignore temporary tables not created in current batch.

yes

Remarks

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

Effort To Fix
20 minutes per issue.
Categories

Explicit Rules

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
 1SELECT 'Total income is', ((OrderQty * Price) * (1.0 - UnitPriceDiscount)), ' for ',
 2p.Name AS ProductName 
 3FROM Production.Product AS p 
 4INNER JOIN Sales.SalesOrderDetail AS sod
 5ON p.ProductID = sod.ProductID 
 6ORDER BY ProductName ASC;
 7
 8SELECT p.ProductName AS ProductName, 
 9NonDiscountSales = (OrderQty * UnitPrice),
10Discounts = ((OrderQty * UnitPrice) * UnitPriceDiscount)
11FROM Production.Product AS p 
12INNER JOIN Sales.SalesOrderDetail AS sod
13ON p.ProductID = sod.ProductID 
14ORDER BY ProductName DESC;
15GO

Analysis Results
  Message Line Column
1 EX0019 : Invalid column reference Price. 1 39
See Also

Other Resources