Naming Convention

August 29, 2019 by

APX1088 – Parameters names not specified explicitly Description: This rule evaluates the T-SQL script for executing a stored procedure without referencing parameters explicitly by name. Although it is possible, it is considered a best practice to provide the names of the parameters. For more information visit https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/execute-a-stored-procedure?view=sql-server-2017 Example script:

Message: Explicitly named parameters not […]

Query

August 29, 2019 by

APX1090 – Avoid Select(*) Description: This rule evaluates the T-SQL script for using “SELECT *”. Avoid using SELECT * in your script unless it is required. Always explicitly list the columns in a query to create more maintainable and predictable code. For more information visit https://stackoverflow.com/questions/321299/what-is-the-reason-not-to-use-select Example script:

Message: Statement contains SELECT * APX1091 […]

Performance

August 28, 2019 by

APX1092 – HAVING with non-aggregate functions Description: This rule evaluates the T-SQL script for using HAVING with non-aggregate functions. HAVING should be used only with aggregate functions. For more information visit https://www.techonthenet.com/sql/having.php Example script:

Message: HAVING clause is used in a non aggregate function APX1096 – Comparison with NULL Description: This rule evaluates the […]

Design

August 28, 2019 by

APX1129 – Index type not specified explicitly Description: This rule evaluates the T-SQL script for NOT specifying the Index types, CLUSTERED or NONCLUSTERED explicitly. If not specified, the CREATE INDEX statement will be used to create non-clustered index. It is recommended to specify the type of the index as Clustered or Non-clustered in the CREATE […]

Deprecated features

August 27, 2019 by

APX1094 – Non-ANSI outer join Description: This rule evaluates the T-SQL script for using Non-ANSI outer join syntax e.g. *=, =* that has been deprecated. Use ANSI OUTER JOIN statement instead. For more information visit https://docs.microsoft.com/en-us/sql/sql-server/install/outer-join-operators-and-are-not-supported-in-90-or-later-compatibility-modes?view=sql-server-2014 Example script:

Message: Statement uses Non-ANSI outer join APX1119 – String = expression_alias Description: This rule evaluates the […]

Code

August 27, 2019 by

APX1086 – Check syntax errors Description: This rule evaluates the T-SQL script for any syntax error, by parsing the T-SQL statement and show any errors. It is recommended to check the documentation for each T-SQL statement in order to use it in the query properly. For more information visit https://www.tsql.info/ Example script:

Message: Incorrect […]

SQL code smells rules

August 27, 2019 by

Code APX1086 – Check syntax errors APX1095 – GOTO Usage APX1112 – Semi-colons statement terminator APX1113 – Uninitialized variable APX1114 – Unused parameter APX1123 – SET NOCOUNT OFF Usage APX1131 – Un-closed cursor APX1132 – Cursor not deallocated APX1133 – RAISERROR with severity above 18 missing WITH LOG clause APX1136 – Direct use of Date-Time […]

Screenshot of Query Store fully enabled.

Performance Monitoring via SQL Server Query Store

August 19, 2019 by

SQL Server Query Store is a performance monitoring tool that helps us evaluate the performance of a SQL query in terms of several different performance metrics such as CPU and Memory Consumption, execution time and the I/O cycles consumed by the query. Query store is similar to the windows “Task Manager”. A task manager provides […]