Skip to content

EX0019 : Find references to non-existing objects and columns

The rule identifies references to non-existing objects or columns in SQL queries.

Referencing objects or columns that do not exist can lead to runtime errors, hinder query performance, and disrupt database operations. This problem often occurs due to typos, outdated schema information, or incomplete migrations.

Example of a query with a reference to a non-existing column:

SELECT NonExistingColumn FROM TableName;

The query above is problematic because NonExistingColumn does not exist in TableName . Attempting to execute this query will result in an error, halting the process and potentially impacting application stability.

  • A runtime error can occur when attempting to access a non-existing object, causing disruptions in application workflows.

  • Frequent schema changes without corresponding updates to queries can lead to maintenance issues and difficult-to-trace bugs.

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

Name Description Default Value
IgnoreTemporaryTables The parameter specifies if to ignore temporary tables not created in current batch. yes

The rule requires Analysis Context. If context is missing, the rule will be skipped during analysis.

20 minutes per issue.

Explicit Rules

There is no additional info for this rule.

SELECT 'Total income is', ((OrderQty * Price) * (1.0 - UnitPriceDiscount)), ' for ',
p.Name AS ProductName
FROM Production.Product AS p
INNER JOIN Sales.SalesOrderDetail AS sod
ON p.ProductID = sod.ProductID
ORDER BY ProductName ASC;
SELECT p.ProductName AS ProductName,
NonDiscountSales = (OrderQty * UnitPrice),
Discounts = ((OrderQty * UnitPrice) * UnitPriceDiscount)
FROM Production.Product AS p
INNER JOIN Sales.SalesOrderDetail AS sod
ON p.ProductID = sod.ProductID
ORDER BY ProductName DESC;
GO
  Message Line Column
1 EX0019 : Invalid column reference Price. 1 39

Analysis Rules