ApexSQL Refactor is a free SQL formatter and database refactoring tool for SQL Server. Format SQL queries, refactor SQL code and database tables with ease. It can format and refactor code directly in SSMS or VS, qualify objects, expand wildcards, encapsulate SQL, locate and highlight unused variables and parameters, and much more for free.
Features: SQL Server 2014 support: Format and refactor your code directly in SQL Server 2014 Management Studio. Refactor SQL Server 2012 objects including FileTables . Support for all Visual Studio versions: Format and refactor SQL code in Visual Studio 2013. Split table: Improve your database design and make large tables more manageable by partitioning them. Advanced SQL formatting: Create custom formatting profiles and share them across your team. Customizable options: Layout your SQL code with over 160 customizable options and preview the impact of the changes. Impact analysis: Preview the impact of changes with difference highlighting. Expand wildcards: Transform * wildcards into explicit lists of column names. Qualify object names: Qualify columns with schema table names and schema or aliases. Copy SQL code as: Render T-SQL into its Java, C#, C++, VB .NET, PHP, Ruby, Delphi or PowerBuilder equivalent. Copy and paste it into your applications data access layer. Add surrogate key: Replace complex, multi-column primary keys with a single column surrogate key. Find unused variables and parameters: Clean up your code by identifying and removing parameters and variables that aren't used. Replace one-to-many relationships: Add a new associative table to replace one-to-many relationships. Change parameters: Add, remove or change parameters without breaking dependencies from referencing objects. Encapsulate SQL: Convert blocks of SQL code into scalar or table functions, stored procedures and views. Automatically identify and create the input parameters.
MSSQL Server 2014, 2012, 2008 or 2005 with with Microsoft SQL Management Studio 2005 with SP2