MPTW | 6 | Param passed by name twice | Variable | |
exampleexec proc @p1 = 1 @p1 = 2
A parameter is passed by name twice
consequence
Probably a typo, remove.
|
PERR | 6 | Parsing Error | Regular | |
example
This is a SQLBrowser general parsing error
consequence |
QFPU | 4 | Unclosed Force plan | Performance | |
example
Must close forceplan
consequence
unwanted forceplan on subsequent queries
fix
set forceplan off
|
QFIN | 4 | Force index through index number | Misc | |
exampleselect * from t(2)
Creates code which is too tight to index order creation
consequence
Use index name instead of index number
fix |
TNOI | 4 | Table with no index | Misc | |
example
This happens when table has no index at all.
The only cases where this is admitted is for special tables which contains
exactly one line, in which case they are not relational but just a collection of unrelated
global variables.
Every relational table must have an identifier, implemented through a unique index.
"In a relational database, we never record information about something we cannot identify." [Date95]
Read
Relational Keys
consequence
This table will only be accessed through table scan.
fix
Add a unique index.
|
TNOU | 4 | Table with no unique index | Misc | |
example
This happens when a table has no unique index.
Any table must have a key, hence a unique index.
A table without primary key is not a relational table.
"The Key, the whole key and nothing but the key, so help me Codd."
Unique indexes are usefull for both data integrity and for the
query optimizer to find faster access plans.
Read
Relational Keys
consequence
Data quality is poor.
Potential performance hit.
fix
Add one or more unique index ASAP
|
MINU | 4 | Unique Index with nullable columns | Misc | |
example
A Unique Index with nullable columns is bad practice
consequence
Bad performance because the index is less usable
fix |
QJWT | 3 | Join or Sarg Without Index on temp table | Performance | |
example
This is like a join without index but is considered as a warning
when one of the table is a temp table
consequence |
QAPT | 3 | Access to Proxy Table | Misc | |
example
Just a marker
consequence
Can have performance penalty, especially in joins
fix
Use replication
|
MLCH | 3 | Char type with length>30 | Misc | |
exampledeclare @c char(50)
Prefer varchar for strings length > 30, because they are trimmed
consequence
Loss of space (padding)
fix
Use varchar
|
CUNU | 3 | Cursor not updated: cursor should contain 'for read only' clause | Misc | |
example
Sub-optimal lock use, misinformation of reader
fix
add 'for read only' clause
|
CUSU | 3 | Cursor updated through 'searched update': risk of halloween rows | Misc | |
example
Halloween problem
fix |
CUUP | 3 | Cursor updated: cursor should contain 'for update' clause | Misc | |
example
add 'for update' clause
|
NCER | 3 | Naming Convention Error | Misc | |
exampleselect * from table_with_bad_name
Naming Convention allow procs, triggers, tables, views, columns or variables to share a
common naming pattern.
Naming Patterns add consistency to the code and also carries information
about the named object, for instance columns named
tx_something
could denote columns of type text. consequenceSuch a pattern would be parametrized as tx_[a-z]* Naming Patterns are given in the form of Regular Expressions in the Preferences Panel. For more information on Regular Expressions, pls check this page
Inconsistent style
fix
Rename non-compliant items
|
QRPR | 3 | Repeated predicate | Misc | |
example
most often a typo
consequence
bad results because of typo
fix
fix the typo
|
MUPK | 3 | Update column which is part of a PK or unique index | Misc | |
exampleupdate sysobjects set id=1 where id=-1
updating a key is considered bad practice
consequence
use delete + insert
|
MUTI | 3 | Update temptable with identity - 12.5.4 Regression | Misc | |
example
Potential 12.5.4 regression
fix |
MSUC | 2 | Correlated Subquery Marker | Misc | |
example
Correlated SubQuery Marker
consequence |
MDRV | 2 | Derived Table Marker | Misc | |
example
This is just a marker for a Derived Table
consequence |
MDYE | 2 | Dynamic Exec Marker | Misc | |
exampleexec @v
Dynamic execs are difficult to analyze. Avoid if possible!
consequence
Code harder to track
fix
Avoid dynamic execs
|
CRDO | 2 | Read Only Cursor Marker | Misc | |
example
Marker for read only cursors
consequence |
MRST | 2 | Result Set Marker | Misc | |
example
select * from sysobjects
comment
This is just a marker for a Result Set
consequence |
MSTT | 2 | Shared Temptable Marker | Misc | |
example
This is just a marker for a Shred Temp Table
consequence |
MSUB | 2 | Subquery Marker | Misc | |
example
SubQuery Marker
consequence |
CUPD | 2 | Updatable Cursor Marker | Misc | |
example
Marker for updatable cursors
consequence |
MTR1 | 2 | Metrics: Comments Ratio | Metrics | |
example
Shows Comments Ratio
consequence |
MTR2 | 2 | Metrics: Cyclomatic Complexity | Metrics | |
example
Shows
Cyclomatic Complexity
consequence |