From time to time, a database object may need to be renamed for various reasons. When that happens, native features for renaming SQL Server database objects can be very useful. But there are big differences between just renaming SQL Server database objects in the SQL Server Management Studio and Safe renaming them with ApexSQL Refactor.
This article will explain the differences between renaming database objects with SSMS and the ApexSQL Refactor Safe rename feature.
The Format SQL objects feature allow formatting one or more database objects with the specified formatting profile, without having to script them first.
There are three ways to invoke the Format SQL objects feature. First, you need to select a database from which you want to format objects. Otherwise, when you try to initiate the Format SQL objects feature, you’ll be prompted with the following message:
Depending on your environment, splitting a SQL table may have a positive impact on the overall database performance. For instance, in scenarios where a table contains some large but rarely used columns, moving them to a separate table will increase performance as the frequently used data will be stored in a much smaller table, and the rarely used data will be only looked up when required. The impact on performance caused by the occasional joining will be compensated just by having SQL Server look up the data that’s used more often in a table which requires less disk space leading thus to decrease in I/O and potentially increase in page cache hits.
Finding parameters and SQL variables that are only defined in the existing SQL Server stored procedures and functions, but never actually used, is not a problem, but for maintaining complex code, with dozens of parameters and variables you’ll need a tool like ApexSQL Refactor – a free SQL Server Management Studio and Visual Studio add-in, and useful SQL query formatter
The previous article covered SQL query readability basics such as capitalization strategies and their implementation in SQL formatter by ApexSQL. This time, commas, spacing, and aligning will be detailed. One of the quickest ways to wreak havoc among developers is to start a discussion about how commas should be treated within the code, particularly in a SELECT list. Let’s look at how commas can be treated in ApexSQL Refactor.
Many development teams spend an inordinate amount of time arguing over styling and formatting preferences. Although these preferences are often subjective, at the end the code should be consistent. Since styling comes up frequently during code reviews, it is a good idea to have a strategy in place for dealing with it. This article series will address several SQL readability strategies as well as provide examples that demonstrate different ways you can format T-SQL in ApexSQL Refactor. Let’s begin with capitalization and object naming.
The Safe rename feature is a SQL code formatter feature in ApexSQL Refactor. This feature makes possible to rename objects in SQL Server without breaking the database dependencies. It generates a SQL script that changes the object name and updates all the dependent database objects.
After explaining basic principles for replacing one-to-many relationships with associative tables in Part 1 of the article, this sequel will show you how to easily accomplish that via the Replace one-to-many relationship feature.