SQL Prompt 9

Automatically Fixing Issues

As an extension to Code Analysis, SQL Prompt allows you to automatically fix certain issues that are present in your code. Currently, SQL Prompt supports the automatic fixing of the following issues:

  • ST006: Old style TOP clause is used.
  • ST008: Non-named parameter style used
  • MI005: Variable is declared but never used.
  • BP005: Asterisk in SELECT list.
  • BP006: TOP without ORDER BY.
  • BP014: [NOT] NULL option is not specified in CREATE/DECLARE TABLE statement
  • BP022: Money/SmallMoney datatype is used.
  • ST013: Non-ANSI NOT_EQUAL operator used (!=).

More auto-fixes coming soon.

When you left-click an issue present within your code, a light bulb icon will appear in the sidebar. Issues that are fixable are represented by an orange light bulb: , whereas issues that cannot be fixed are represented by a blue one: When you click the orange light bulb, you will see a drop down with two options: 1) Apply Fix (the exact description depends on the fix) and 2) Show Issue DetailsClicking the Apply Fix button will automatically fix the issue in your code.




Note that some fixes will require you to enter additional information. For example, after applying the fix for issue BP006: TOP without ORDER BY, you will need to type the name of the column or expression that you want to use to sort your results.


Didn't find what you were looking for?