Quick Filtering in SSMS–#SQLNewBlogger

I saw someone limit the databases they see in SSMS, which isn’t something I often do, but I thought this was great.

A Long List

This is the list of databases on a demo instance I have. While it’s a lot since I do a lot of testing with customers and colleagues, I see plenty of people will lists of databases longer than this.

2023-09-18 09_39_38-Window

I also watch them scroll like I do when trying to find an object in a database.

However, for demos, this is a lot, so I like to slim things down. I used to have a script to detach all the databases and then attach the ones I need, but that’s time consuming and once in awhile, I need a different database, so that’s an issue.

I saw the someone filter their list by clicking the filter button in the Object Explorer. This is the funnel button shown here:

2023-09-18 13_57_35-Window

Once you click this, a dialog appears that let’s you enter your filter criteria. I’ll use a simple filter of “zero” to limit to those databases in my zerodowntime demo.

2023-09-18 09_39_25-Window

Once I click “OK”, I see only those databases listed.

2023-09-18 09_39_18-Window

If I want to get everything back, I can click filter again and then delete my criteria, or click “Clear” filter. That gets me the entire list back.

2023-09-18 09_39_32-Window

Easy.

SQLNewBlogger

This post was something I jotted a note about when I saw someone do this. The note was literally “write about filtering in SSMS object explorer”. I took that and wrote this post in 10 minutes, including time to grab screen shots.

You could do this as well, showcasing the knowledge that you’re learning to use tools better, which make you more productive. Employers love that.

Write your own post with more advanced filtering.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , , . Bookmark the permalink.

2 Responses to Quick Filtering in SSMS–#SQLNewBlogger

  1. I use a custom view I created, an electronic DDDF (Data Dictionary File) if you will that I can use and one of teh default filtering it does is to eliminate from the query’s results any table with now dat, 0 rows and in the production database we use for our accounting software there are 1000’s of empty tables b/c we don’t use every module/feature available to the accounting software.

    A few years later after creating this view I came up with a clever way to use it to search for any row in any table for an Email address. I do this by filtering the query to only table+Column where column Name like Email. Then within the SELECT I dynamically build a SELECT Col FROM TABLE where Col Like ‘%’ + @sMysEmailAdress + ‘%’ and then copy the results from that into a new query window and viola an instant search for a matching email in any column that has Email in it’s name.

    Like

  2. way0utwest says:

    Works good as long as no one performs sql injection 😉

    Like

Comments are closed.