Maintenance

APX1109 – QUOTED_IDENTIFIERS or ANSI_NULLS in a programmability object

Description:

This rule evaluates the T-SQL script for using QUOTED_IDENTIFIERS or ANSI_NULLS options inside programmability objects.

Using QUOTED_IDENTIFIERS or ANSI_NULLS options inside programmability objects will be ignored.

For more information visit

https://www.sqlshack.com/sql-server-set-options-affect-query-result-set-concat_null_yields_null-set-numeric_roundabort-set-quoted_identifier-set-nocount-set-xact_abort/

Example script:

Message:

Consider removing QUOTED_IDENTIFIER or ANSI_NULLS type identifier as they are ignored in this context

APX1118 – Unassigned variable

Description:

This rule evaluates the T-SQL script for having variables that have been declared but never assigned or used, where it should be removed to streamline code.

Consider assigning values for the variables before its first use.

For more information visit

https://docs.microsoft.com/en-us/sql/t-sql/language-elements/variables-transact-sql?view=sql-server-2017

Example script:

Message:

Variable @’*’FailedVAR is declared but not used

APX1143 – Potential “unfinished” development

Description:

The presence of keywords like, TEST, TODO, HACK and UNDONE in comments can indicate unfinished work has migrated to Test or Production.

Edit the rule to add/update/remove key words

Example script:

Message:

Potential unfinished work detected – ‘*’

APX1146 – Unused variable

Description:

This rule evaluates the T-SQL script for never using the variables, even if they are assigned, where these variables should be removed to streamline code.

Make sure to declare only the variables that you need in your code and remove all unused variables.

For more information visit

https://docs.microsoft.com/en-us/sql/t-sql/language-elements/variables-transact-sql?view=sql-server-2017

Example script:

Message:

Unused variable, @bad1, detected

APX1190 – Output parameter never assigned

Description:

This rule evaluates the T-SQL script for not assigning values to the output parameters.

Make sure to assign value to the SP OUTPUT parameters.

For more information visit

https://docs.microsoft.com/en-us/sql/connect/jdbc/using-a-stored-procedure-with-output-parameters?view=sql-server-2017

Example script:

Message:

Output parameter, @param’*’, isn’t used

APX1203 – Duplicate identifier

Description:

This rule evaluates the T-SQL script for using the same name for different objects.

Try to use unique names for the different database objects.

Example script:

Message:

Object [foo] already exists

APX1224 – Comment header

Description:

This rule evaluates the T-SQL script for NOT using comment header blocks.

Comment header improve code maintainability by making the programmability object self-documenting.

For more information visit

https://sqlserverfunctions.wordpress.com/2014/10/13/t-sql-code-header-comments/

Example script:

Message:

Comment header is missing for this CreateProcedure

SQLShack
Latest posts by SQLShack (see all)