Miscellaneous rules
Published 16 November 2017
Rules that don't fall under one of the other categories.
CGUNP – Unparsed SQL
Unable to parse SQL code. The SQL may be incorrect or contain syntax that SQL Code Guard doesn't understand.
Try fixing the SQL or rewriting it in a simpler form.
MI001 – Table var is declared but never used
Although it makes very little difference to performance, every table variable results in a table being created and deleted in the TEMPDB database.
Also, clean code -- without unnecessary and unused parameters, variables and values -- greatly simplifies the complex task of managing large SQL projects and databases.
MI002 – Temp table is declared but never used
Temp tables have a small cost to performance, because they are created and deleted in the TEMPDB database.
MI003 – Unqualified column name
This issue is not registered for query with single table in the FROM clause.
A Column name should be qualified with its table name if it is part of a join or is in a subquery, even if it is currently unambiguous. At some point a change could be made that will cause an error.
MI004 – Usage of sp_executesql (only in procedure/trigger)
MI005 – Variable is declared but never used
Unused variables are often a symptom of technical debt or unfinished work.
MI006 – Parameter is declared but never used
Unused parameters are often a symptom of technical debt or unfinished work.
They are sometimes necessary for backward-compatibility so only remove if safe to do so.
MI007 – WAIT FOR DELAY/TIME used
Including WAITFOR will slow the completion of the SQL Server process and can result in a timeout message in the application. If necessary, adjust the timeout setting for the connection at the application level.
MI008 – QUOTED_IDENTIFIERS option inside stored procedure, trigger or function
Setting the QUOTED_IDENTIFIERS options inside a stored procedure, trigger or function will have no effect.