Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tool for refactoring SQL, a bit like a ReSharper for SQL [closed]

The sort of stuff I'm after right now is quite basic:

  • Auto format
  • Detect unused variables
  • Variable naming convention checking

I wouldn't be surprised if there was a tool available that could handle more complex refactorings such as those found in Refactoring Databases, but I appreciate that the added complexities introduced by current db structure and data state may prevent many of them.

I suppose I'm after ReSQLer

like image 628
MPritchard Avatar asked Feb 03 '10 14:02

MPritchard


People also ask

How do you refactor in SQL?

sql) in Solution Explorer and select View Code to open the script in Transact-SQL editor. Right click [Products] in the script, select Refactor, and Rename. In the New Name field, change it to Product. Leave the Preview Changes option checked and click OK.

What is Apex SQL Refactor?

ApexSQL Refactor is a SQL Server Management Studio and Visual Studio add-in, for format and refactor SQL code and objects. ApexSQL Refactor has 200+ formatting options and nearly 15 code refactors.

What does it mean to refactor a query?

A database refactoring is a simple change to a database schema that improves its design while retaining both its behavioral and informational semantics. Database refactoring does not change the way data is interpreted or used and does not fix bugs or add new functionality.


2 Answers

RedGate offers SQL Refactor and SQL Prompt, along with a slew of other SQL related tools. Check out their pages for more info and for a free trial.

like image 102
Ahmad Mageed Avatar answered Sep 20 '22 10:09

Ahmad Mageed


There is a free SQL formatting and refactoring add-in for SSMS and VS developed by ApexSQL. I suggest you check these articles before you decide if it's the right tool for you:

http://solutioncenter.apexsql.com/category/sql-code-refactoring/

like image 39
Dwoolk Avatar answered Sep 23 '22 10:09

Dwoolk