December 9, 2022 in Tips by David Wiseman2 minutes
Group instances in the tree by 1st character of the instance name
If you have a large number of instances it might be useful to group instances by tag, making the tree easier to navigate. DBA Dash automatically provides a number of system tags and you can add your own tags in the GUI. In this blog post we will see how to group by the first character of the instance name - without having to manually tag each instance.
The script below will take the 1st character of the instance name and generate the tags. It will then associate the tags with the instances with the insert into dbo.InstanceIDsTags (Regular Instances) and dbo.InstanceTags (Azure DB).
You can schedule this script to run as a SQL Agent job to automatically apply this tag to your instances.
To apply the grouping, just select the Tag from the Group menu. If you want the group to persist next time you load DBA Dash, select the “Save” option.
If you want to completely remove the “Char1” tag, you can run the script below:
You might have some different tagging requirements based on your naming conventions used for your SQL instances. This script could be used as a starting point if you have different requirements.
Note: Editing tags in this way is not guaranteed to work between versions of DBA Dash. There is a small chance it could be broken by some future update.