ApexSQL Database Power Tools for VS Code – Object search

Applies to

ApexSQL Database Power Tools for VS Code

Summary

This article describes how to use the SQL Object search feature to find objects in MySQL and MariaDB databases.

Description

By using the SQL Object search feature, objects in MySQL or MariaDB databases can be found such as tables, table columns, stored procedures, user-defined functions, procedure and function parameters, views, etc. based on a specified phrase in the Search phrase box of the Object search pane:

Object search pane

Quick tip icon

Quick tip:


Minimum the SELECT privileges need to be granted to a user for the Object search feature to find any objects in the searched database

To open the SQL Object search pane and start searching, firstly, the feature needs to be launched using the Object search command. From the ApexSQL server explorer pane, select a MySQL or MariaDB server, right-click, and, from the context menu, choose the command as shown below:

Object search command from server level context menu

The same command is available at a database level. In the ApexSQL server explorer pane, expand a MySQL or MariaDB server, under the Databases folder, select a database for which want to search objects, right-click and, from the context menu, select the Object search command:

Object search command from database level context menu

SQL Object search pane

On the Object search pane, besides the search phrase that can be set in the Search phrase box and selecting server and database for searching objects from the Server and Database drop-down box, additionally, the searched scope can be narrowed down by checking only the objects types which you are interested in (table, table columns, stored procedures, etc.) under the Search for object types section:

The Search for object types section

By default, the Tables checkbox in the Search for object types section is checked.

To specify where the search phrase should look for the results, select either the Object name or the Object bodies option or both.

By default, the Object name option is checked:

Specify search scope

Quick tip icon

Quick tip:


The Object bodies option can match comments in the object’s DDL to the searched phrase

For example, if under a stored procedure (e.g., rewards_report), in the comment, a word exists that matches the searched criteria that is set in the Search phrase box (e.g., Customer IDs) when the Find button is clicked, in the search result grid, a procedure will be shown which contains the word in the body:

SQL Object search result grid

Script comments

To perform a search for the specified word in the Search phrase box only, the Exact match option needs to be enabled:

The Exact match command

Note: When this option is enabled, and the word film is specified, results only for that word will be displayed in the search result grid – results for words like film_actor, film_text, etc. will be ignored.

Navigate to node feature

Under the search result grid as in the Name column, when clicked on the value, the searched objects can be easily located in the ApexSQL server explorer pane:

Find objects in the ApexSQL server explorer pane

Export feature

All results from the search result grid can be exported in one of the available formats like Excel, HTML, CSV, JSON.

On the top right corner of the search result grid, there are icons for exporting values in the above-mentioned formats. Click on the icon for the desired format (e.g., Export to Excel) and in the Sava as window, choose a file location, enter a name for the file and click the Save button:

Export data from the SQL Object search result grid

The exported data will look like this:

Exported data

Q&A

Q: Can search be performed on the system databases using the SQL Object search feature?

A: Yes, it can.

Q: I used the Object search feature, but any of the system databases are not shown under the Database drop-down list. What should be done to system databases to appear in the Database drop-down list?

A: To see system databases in the Database drop-down list of the Object search pane, first the Show system databases in server explorer option under the Extensions setting needs to be enabled:

Include system databases in search scope

Once enabled the option, the system databases will appear in the Database drop-down list:

Database drop-down list shows system databases