SQL Enlight is a static code analysis and refactoring tool for Microsoft SQL Server.
The tool integrates with SQL Server Management Studio and Visual Studio and includes command line interface, MSBuild and NAnt tasks and a static code analysis check-in policy for Team Foundation Server.
Features
Code Analysis
Use the analysis feature to identify common performance, design and database objects naming issues and get advises and hints for optimizing your T-SQL code and databases.
Identify potential and actual performance and design issues.
Reformat T-SQL code
SQL Enlight allows you to format your code against a set of more than 40 configurable layout rules. The formatting rules include indentation, aligning, spaces, braces layout, anything related to your code format. By default SQL Enlight comes with set of predefined layout templates which you can use as a start.
Improve readability and maintainability.
Facilitate third party databases intake and maintenance.
Configure custom layout templates to fit your preferences.
Follow your predefined coding guidelines.
Implement your own rules
Using the analysis rule designer you can easily implement your own analysis rules or modify the existing out of the box rules that come with SQL Enlight.
Use XSLT and XPath to implement powerful custom analysis rules.
Support analysis of both T-SQL code and database schema.
Use database context information: database schema, indexes, statistics and etc.
Use dynamic management views information.
Index fragmentation analysis support.
Query execution plan analysis support.
Executed statements history
Use the Statement History reuse and examine the recently executed T-SQL statements.
Collect and reuse executed statements with a single mouse click.
Instant access to the recently executed T-SQL statements.
T-SQL script summary
Using the Script Summary you can view and navigate through the hierarchically structured summary of all batches and statements in the current T-SQL script. The Script Summary shows all actions that the script performs, in the order in which they occur.
Identify components in large T-SQL scripts.
Provide easy navigation through script.
Refactor T-SQL code
Available refactoring commands:
Extract parts of T-SQL code as stored procedure, function, view, as a separate script or as a sp_executesql call.
Expand calls to the sp_executesql stored procedure.
Add schema name to all not qualified objects found in the T-SQL script.
Facilitate refactoring of large stored procedures and scripts.
Variables referenced in the extracted code are encapsulated as parameters.
Optionally create reference to the new object in the original script
Add statement terminators
Delimit and Un-delimit identifiers
T-SQL statements outlining
The statements outlining feature provides a quick and convenient way to distinguish separate statements in large T-SQL scripts by surrounding each statement with outlining rectangle.
Identify components in large T-SQL scripts.
Highlight individual statements in T-SQL code.
Validate T-SQL code for syntax errors
SQL Enlight uses its internal parser to validate the T-SQL code. When syntax error is found in the SQL script, it is highlighted in the code editor and a tooltip describing the error is supplied.
Validate code without the need of active SQL connection.
Highlight errors in the code editor.
Examine and navigate to specific syntax error using the SQL Enlight Error List.
Generate analysis reports
You can create analysis report by either using the command line tool or one of the analysis MSBuild tasks.
Generate XML reports of analysis rule violations.
Control output report formatting and content.
Continuous integration support
Use SQL Enlight in your automated builds in order to identify issues earlier while the fixing costs are still minimal.
Support automated builds.
SQL Enlight comes with a command line version.
MSBuild and NAnt tasks for analyzing and reformatting code are also included.
Support for generating analysis reports.
Configure by your own standards
Configure and use the provided out of the box analysis and layout rule based on guidelines and industry best practices to your needs, or define your own rules that follow your own standards.
Configure analysis rules to fit your coding standards.
Configure your own code formatting templates.
Group analysis rules in your own categories.
Modify or extend existing rules to fit your needs.
Use specific rule parameters to change analysis rule behavior.
Database and server schema analysis
Along with T-SQL code analysis, SQL Enlight provides supports for analyzing SQL Server schema objects and using database schema during analysis, and also supports executing custom queries and retrieving data directly from the context server and database.
Fast and easy way of analyzing whole servers, all server databases, single database or specific database object ( procedure, function, view of trigger) or database object type.
The database schema is available to the analysis rule during the analysis process.
Schema object analysis is available from the command line tool, build tasks and form Object Explorer window of SQL Server Management Studio.
Support for using SQL Server Dynamic Management Views and Functions inside analysis rules.
Query execution plan analysis
The estimated query execution plan analysis features provides the following benefits:
Automate execution plan analysis.
Analyze execution plan of T-SQL script, stored procedures and views.
Check for missing indexes in query plan.
Check for high cost operators (Bookmark Lookups, Table Scans, Index Scans and etc.).
Index and statistics analysis
SQL Enlight provides several out of the box analysis rules for analyzing indexes and statistics state and efficiency:
Find missing indexes.
Find unused indexes.
Find duplicate or overlapping indexes.
Missing indexes on foreign key columns.
Identify fragmented indexes.
Find better candidates for clustered index.
Identify missing or outdated statistics.
Integration with Visual Studio and SQL Server Management Studio
SQL Enlight supports integration with Microsoft SQL Server Management Studio and Microsoft Visual Studio as Add-on.
Analyze T-SQL code inside the development environment.
Analyze SQL Server objects inside SQL Server Management Studio.
SQL Server Management Studio Object Explorer integration.
Quick change of layout templates.
Analyze T-SQL script, databases or server using all or individual analysis rules or groups.
Errors and violations are highlighted in code editor.