In the new version of ApexSQL Refactor, 2014 R6 we added eight new features
Author and Description fields in formatting profiles
ApexSQL Refactor 2014 R6 now supports author and description fields for formatting profiles. This will allow users to create, describe, and share formatting profiles in a team, company, community
Granular parenthesis settings
In previous version of the addin, there was only global Parenthesis settings, which means, all parenthesis were formatted equally.
Example:
Now, along with global parenthesis setting, there are separate parenthesis settings for
- column lists
- arithmetic operations
- comparison operations
- logical operations
If some of these settings are not checked the global setting for that context will be used.
Example of separate settings for different context for Arithmetic operations:
Arithmetic operations:
Alignment of data types
Now it is possible to align data types within SQL code.
Alignment turned off:
CREATE PROCEDURE spInsertOrUpdateProduct @ProductNumber NVARCHAR(25), @ListPrice MONEY
Data types aligned left:
CREATE PROCEDURE spInsertOrUpdateProduct @ProductNumber NVARCHAR(25), @ListPrice MONEY
Data types aligned right:
CREATE PROCEDURE spInsertOrUpdateProduct @ProductNumber NVARCHAR(25), @ListPrice MONEY
CamelCase capitalization
In ApexSQL Refactor 2014 R6 it’s now possible to format keywords, types, system functions and variables in either lower camel case or upper camel case.
lowerCamelCase:
create procedure spInsertOrUpdateProduct @productNumber nVarchar(25), @listPrice money as if exists( select * from production.product where productNumber = @productNumber and listPrice > 1000 ) update production.product set listPrice = ( listPrice - 100 ) where productNumber = @productNumber; else insert into production.Product( productNumber, listPrice ) select @productNumber, @listPrice; go select getDate(); go
UpperCamelCase:
Create Procedure SpInsertOrUpdateProduct @ProductNumber NVarchar(25), @ListPrice Money As If Exists( Select * From Production.Product Where ProductNumber = @ProductNumber And ListPrice > 1000 ) Update Production.Product Set ListPrice = ( ListPrice - 100 ) Where ProductNumber = @ProductNumber; Else Insert Into Production.Product( ProductNumber, ListPrice ) Select @ProductNumber, @ListPrice; Go Select GetDate(); Go
BEGIN END block formatting
In ApexSQL Refactor 2014 R6 two new features for flow control configuration have been added. Indent BEGIN and END blocks and Indent code within BEGIN and END blocks.
Indent BEGIN and END blocks indents begin and end block relative to previous statement.
AS BEGIN SELECT * FROM person.person; END; GO
Indent code within BEGIN and END blocks indents the code within begin and end block.
AS BEGIN SELECT * FROM person.person; END; GO
Both options can be turned on or off at the same time.
Place JOIN aligned with the FROM keyword
ApexSQL Refactor 2014 R6 old confusing options regarding placing join keyword and joined object on new line is replaced with two new options:
- Place JOIN keyword on new line.
- Place joined object on new line.
With these two options it’s possible to set either join keyword or joined object in new line and their alignment. The new options are more flexible then old ones and they can work independently to each other.
An option to insert an empty line before/after each comment/statement
With new ApexSQL Refactor 2014 R6 is possible to split each statement with empty line. It increases readability of the code and thus developer’s productivity.
Align SELECT with INSERT keyword
ApexSQL Refactor 2014 R6 also supports alignment/indentation of nested SELECT statements within the INSERT statements. User can either choose to align SELECT with INSERT, or to left SELECT statements indented within the INSERT statement.
Aligned SELECT with INSERT:
INSERT INTO #tmp SELECT * FROM person.person; GO
Indented SELECT within INSERT:
INSERT INTO #tmp SELECT * FROM person.person; GO
June 17, 2015