Hello, and welcome to this video presentation in which we’ll introduce different ways of finding SQL objects in a SQL Server database and safely rename them using tools from ApexSQL Fundamentals Toolkit for SQL Server pack without typing a single line of code.
To find SQL objects in a SQL Server database, two tools from the ApexSQL Fundamentals Toolkit for SQL Server pack can be used.
The first tool is ApexSQL Complete, and its Go to objects feature. This feature can be used to perform a quick and fast way to find and locate an object in Object Explorer.
To initiate the Go to object feature, two ways can be used.
In Object Explorer, select a database and from ApexSQL toolbar, click the Go to object button:
Or use the Ctrl+Alt+Y keyboard shortcut.
Once the Go to object window appears, in the Search box, type a name or part of the name of the object that you want to find.
In the search list, all objects that match the typed word will be displayed in the Search box and, at the bottom of the window, the number of the found objects will be shown:
Additionally, a search scope can be narrowed down with the object type criteria, for example, table type:
Now, in the search list, only tables will be displayed and only those that match the search criteria that was typed in the Search box:
Double-click on the item from the search list, and that object will be located in the Object Explorer panel:
To perform a more complex SQL object search over one or more databases, the Object search feature from ApexSQL Search add-in can be used.
To initiate this feature, in Object Explorer, right-click on a database, and from the context menu, choose the Object search command. The same command can be initiated from the ApexSQL Search toolbar or ApexSQL Search menu:
The Object search pane will appear:
In the Search text box, enter the search string, and next to the box, on the right side, choose where the search will be performed, in the object name, object body, etc.
Under the Object types drop-down box, you can choose which object types will the search go through:
Under the Database drop-down box, you can choose on which databases the search will be performed:
When the search parameters are set, click the Find button. All results will be shown in the results grid:
To locate the desired object in Object Explorer, in the results grid, use the right-click on that object, and from the context menu, choose the Navigate to object explorer node command:
Now, when the SQL object is found, to safely rename it without typing any line of code, you can use the Safe rename feature, which can be initiated either from Object Explorer or from ApexSQL Search results grid. Right-click on the object, and from the context menu, choose the Safe rename command:
The Safe rename window will appear:
In the New name box, enter a name and click the Preview script button if you want to review the code or the rename sequence:
If everything looks good, click the Create script to generate a renaming code in a new query editor:
Here, you can additionally review the generated code before you click the Execute button.
Once the renaming is finished, refresh Object Explorer, and the new name will appear for the chosen object.
With the Safe rename feature you can rename tables, columns, views, stored procedures, functions, parameters without breaking any dependencies.
Thanks for watching. For more information please visit www.apexsql.com