SQL Refactor - 1.3
Learning SQL Refactor - 1.3
Find unused variables and parameters
SQL Refactor can highlight any parameters or variables that are unused in the current script.
A parameter or variable is considered to be unused if it has been declared or assigned a value, but not queried or used in any control statements, and not used in INSERT or UPDATE statements, WHERE clauses, PRINT or EXECUTE statements, loops or case statements, and so on.
Parameter and variable values that are assigned but not used are also highlighted. In the following example, @i is assigned the value NULL, but this value is not used before @i is assigned the value 4.

To find unused variables and parameters:
- Open the source script in a SQL Server Management Studio query editor.
- If required, select the code that contains the parameters and variables that you want to check.
If you do not select any code, all parameters and variables in the script are checked.
- On the SQL Refactor menu, click Find Unused Variables and Parameters.
SQL Refactor underlines the unused parameters, variables, and values in the query editor.
See also |
Was this article helpful?
SQL Refactor
- Menu item grayed out
- Removing menu items after uninstalling SQL Prompt and SQL Refactor
- Installation fails when Management Studio is not installed (version 1.1)
- SmartRename is greyed out
- Installer doesn't recognise that SSMS is installed
- Dependency creation in Smart Rename
- Add-in failing to load into SQL Server Management Studio on Vista
- Removing SQL Server Management Studio Integration after uninstallation
- Layout SQL Error
- Log files
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Refactor
- Activating your products
- Activating your products
- Getting help offline
- SQL Refactor release notes - version 1.xx
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Refactorings