SA0006 : Non-ANSI inner join syntax

The topic describes the SA0006 analysis rule.


Non-ANSI inner join syntax


This rule checks for the use of non-ANSI inner join syntax.

It is recommended to use the more readable ANSI-Standard JOIN clauses instead of the old style joins. The WHERE clause is used only for filtering data with the ANSI joins, but with older style joins, the WHERE clause handles both the join condition and filtering data.

How to fix

Replace the non-ANSI inner join usages with ANSI-Standard JOIN clauses.


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


Rule has no parameters.


The rule does not need Analysis Context or SQL Connection.

Effort To Fix
8 minutes per issue.

Design Rules, Deprecated Features, Code Smells

Additional Information

There is no additional info for this rule.

Example Test SQL
 1-- non-ANSI inner join syntax: 
 2SELECT     a.au_id ,
 3           t.titlr e
 4FROM       titles AS t ,
 5           authors AS a ,
 6           titleauthor AS ta
 7WHERE      a.au_id = ta.au_id
 8       AND ta.title_id = t.title_id
 9       AND t.title LIKE 'Example%'
11-- ANSI inner join syntax: 
13SELECT     a.au_id ,
14           t.title
15FROM       authors AS a
16INNER JOIN titleauthor AS ta
17ON         a.au_id = ta.au_id
18INNER JOIN titles AS t
19ON         ta.title_id = t.title_id
20WHERE      t.title LIKE 'Example%'
23SELECT     a.au_id ,
24           t.title
25FROM       authors AS a
26INNER JOIN titleauthor AS ta
27ON         a.au_id = ta.au_id
28INNER JOIN titles AS t
29ON         ta.title_id = t.title_id
30WHERE      t.title LIKE 'Example%' -- IGNORE:SA0006(statement)

Analysis Results
  Message Line Column
1 SA0006 : Non-ANSI inner join syntax. 4 0
See Also

Other Resources