LINKS  

Solution Center

Database Solutions for SQL Server DBAs and Developers


How to implement risk free name changes for objects, columns, and parameters

Problem:

Changing the name of an object, column, or parameter is a simple procedure, significantly complicated by the presence of referencing objects. A single name change can cause a cascade of broken dependencies, potentially compromising the structure and integrity of your entire database. Unless all dependent objects are updated, foreign key references to dependent columns will be broken, views and stored procedures that explicitly reference the old name will fail causing application breakage, and many other problems can be created.
SQL Server’s own dependency tracking systems (sysdepends, sp_msdependencies),are often incomplete, inaccurate, or both. You can read more about limitations of SQL Server’s dependency tracking system here, or on Microsoft’s own website. You can spend large amounts of time hunting down dependencies manually, which is at best a tedious process, and at worst an impossible one, if you are working on legacy databases created by other developers.

Solution:

ApexSQL has spent the equivalent of 3 years developing and testing our own proprietary parser that monitors dependencies in real time, quickly and accurately.Our Smart Rename refactor harness the power of this proprietary parser to easily propagate name changes throughout databases, consistently preventing broken dependencies and related errors. The Smart Rename refactor enables you to implement a name change without modifying a single line of script. This refactor is included in both ApexSQL Edit, and our SSMS add-in, ApexSQL Refactor.

Here’s how to take advantage of ApexSQL’s Smart Rename refactor.

Step One:

The Smart Rename refactor is available through the context (right-click) menu of each column.

Right click the column, parameter, or object that you wish to rename, and select Refactors | Smart Rename. This opens the Smart Rename dialog box.

Step Two:

Enter your desired new name. For items other than columns and parameters, you are also able to select a new schema.

Click the Preview button to see the SQL script that contains all SQL commands necessary to rename the selected object, column, or parameter and all dependent objects. You can then click Refresh to update the script preview if any changes have been made.

Step Three:

Click Rename Now to execute the generated script. You can also click Open Script to open the script in a new Query Editor window, in order to manually modify the script.

The Smart Rename refactor of ApexSQL Edit and ApexSQL Refactor is a powerful addition to any developer’s tool set. Combining the accuracy of our proprietary database parser and seamless integration into ApexSQL Edit or SSMS, ApexSQL’s Smart Rename refactor makes SQL Development easier and more efficient. For information about ApexSQL’s full set of refactors, see ApexSQL Edit or ApexSQL Refactor.

Availability
Not yet released. Will be available in ApexSQL Edit 2008.11 and later
Not yet released. Will be available in ApexSQL Refactor 2008.11 and later

Labels:



© 2010 ApexSQL Tools All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy