ssms 2016
This article explains different ways to filter the objects in the object explorer of the SSMS 2016. When we are working with hundreds of databases or hundreds of objects within a database, then it becomes challenging to locate a specific database or database object. To handle such challenges, we can use the filter option in the SQL Server management studio. In the SQL Server management studio, we can apply a filter on the following objects.
本文介绍了在SSMS 2016的对象浏览器中过滤对象的不同方法。当我们使用数百个数据库或数据库中的数百个对象时,查找特定的数据库或数据库对象将变得充满挑战。 为了应对这些挑战,我们可以使用SQL Server管理工作室中的filter选项。 在SQL Server管理工作室中,我们可以对以下对象应用过滤器。
- Databases 资料库
- Tables, Stored Procedures, Functions 表,存储过程,函数
- SQL Jobs and maintenance plans SQL作业和维护计划
The following are the filter criteria supported by the SQL Server Management Studio 2016.
以下是SQL Server Management Studio 2016支持的筛选条件。
|
Object type |
Filter criteria |
|
Databases (SSMS 2016 and above) |
|
|
Database diagrams |
|
|
Tables |
|
|
Views |
|
|
Stored procedures, table-valued functions, aggregate functions and scaler-valued functions |
|
|
SQL Jobs |
|
对象类型 |
筛选条件 |
数据库(SSMS 2016及更高版本) |
|
数据库图 |
|
桌子 |
|
观看次数 |
|
存储过程,表值函数,聚合函数和缩放器值函数 |
|
SQL作业 |
|
在数据库上应用过滤器 (Apply filter on the database )
Suppose you want to search the database whose name contains the Install keyword. To filter the name of the database from the object explorer, right-click on Databases hover on Filter Select Filter Settings. See the following image:
假设您要搜索名称包含Install关键字的数据库。 要从对象资源管理器过滤数据库的名称,请在“ 过滤器选择过滤器设置”上的“ 数据库悬停”上单击鼠标右键。 见下图:

In filter settings dialog box, the value of the “name” property must be “Install”, and “Operator” must be “contains”.
在过滤器设置对话框中, “名称”属性的值必须为“安装”,而“运算符”必须为“包含” 。

Once the filter is applied, you can see the list of filtered databases under “databases”.
应用过滤器后,您可以在“数据库”下看到过滤数据库的列表。
Another example: Suppose you want to search the database whose owner is “sa” and name contains the “AdventureWorks” keyword. In filter settings dialog box, set the properties as follows:
另一个示例:假设您要搜索所有者为“ sa”且名称包含“ AdventureWorks”关键字的数据库。 在过滤器设置对话框中,如下设置属性:
- Criteria 1: The value of the “owner” property must be sa and the operator is “Equals” 条件1: “所有者”属性的值必须为sa ,运算符为“等于”
- Criteria 2: The value of the “name” property must be “AdventureWorks” and the operator must be “contains” 条件2: “名称”属性的值必须为“ AdventureWorks” ,操作员必须为“包含”
See the following image:
见下图:

As you can see, the databases are filtered based on the given criteria.
如您所见,数据库是根据给定条件过滤的。
过滤数据库对象 (Filter database objects)
Suppose we want to get the name of the table that contains the “Department” word and it should be in HumanResource schema. To find the table expand the “AdventureWorks2016” database Right-click on “Tables” Hover on the “filter” and select “filter settings”. See the following image:
假设我们要获取包含“部门”一词的表的名称,并且该表的名称应在HumanResource模式中。 要查找表,请展开“ AdventureWorks2016”数据库,右键单击“表”,将鼠标悬停在“过滤器”上,然后选择“过滤器设置” 。 见下图:

In filter settings dialog box, set the properties as follows
在过滤器设置对话框中,如下设置属性
- Criteria 1: The value of the “Schema” property must be “sa”, and the operator must be “Equals” 准则1: “ Schema”属性的值必须为“ sa” ,并且运算符必须为“等于”
- Criteria 2: The value of the “name” property must be “department” and the operator must be “contains” 条件2: “名称”属性的值必须为“部门” ,而操作员必须为“包含”
See the following image:
见下图:

As you can see, the tables are filtered based on the given criteria.
如您所见,这些表是根据给定的条件过滤的。
Suppose you want to populate all the memory-optimized tables. To find memory-optimized tables, set the value of the “Is Memory Optimized” property to “True”
假设您要填充所有内存优化表。 要查找内存优化表,请将“ Is Memory Optimized”属性的值设置为“ True”

Suppose you want to filter the views that have been created after “26th December 2019″ and are in “Sales” schema. To find the views expand the “AdventureWorks2016” database Right-click on “Views” Hover on the “filter” and select “filter settings”. See the following image:
假设您要筛选在“ Sales”架构中“ 2019年12月26 日 ”之后创建的视图 。 要查找视图,请展开“ AdventureWorks2016”数据库,右键单击“视图”,将鼠标悬停在“过滤器”上,然后选择“过滤器设置” 。 见下图:

In filter settings dialog box, set the properties as follows
在过滤器设置对话框中,如下设置属性
- Criteria 1: The value of the Schema property must be “Sales” and the operator is “Equals” 标准1: Schema属性的值必须为“ Sales” ,而运算符为“ Equals”
- Criteria 2: The value of the Creation date property must be “26-12-2019” and the operator must be “Greater than” 条件2: “创建日期”属性的值必须为“ 26-12-2019”,而运算符必须为“大于”
See the following image:
见下图:

As you can see, the views are filtered based on the given criteria.
如您所见,视图是根据给定的条件过滤的。
Suppose you want to populate the list of the natively compiled stored procedure from the AdventureWorks2016 database. To find the stored procedures, expand the “AdventureWorks2016” database Expand “Programmability” Right-click on “Tables” Hover on the “filter”, and select “filter settings”. See the following image:
假设您想从AdventureWorks2016数据库中填充本机编译的存储过程的列表。 要查找存储过程,请展开“ AdventureWorks2016”数据库,展开“可编程性”,右键单击“表格”,将鼠标悬停在“过滤器”上,然后选择“过滤器设置” 。 见下图:

To populate the natively compiled stored procedure, set the value of the “Is Natively Compiled” property to “True”
要填充本地编译的存储过程,请将“ Is Natively Compiled”属性的值设置为“ True”

As you can see, the stored procedures are filtered based on the given criteria.
如您所见,将根据给定的条件对存储过程进行过滤。
筛选SQL Server作业 (Filter SQL Server Jobs)
Suppose we want to populate the list of SQL Jobs whose name contains the keyword “Backup”, and the owner of the job is “sa”. For that, Expand SQL Server database engine Expand “SQL Server Agent” Right-click on “Jobs” Hover on the “filter” and select “filter settings”.
假设我们要填充名称为包含关键字“ Backup”SQL作业列表,并且该作业的所有者为“ sa” 。 为此,展开SQL Server数据库引擎展开“ SQL Server代理”,右键单击“作业”,将鼠标悬停在“过滤器”上,然后选择“过滤器设置”。

In filter settings dialog box, set the properties as follows
在过滤器设置对话框中,如下设置属性
- Criteria 1: The value of the “Name” property must be “backup”, and the operator must be “contains” 条件1: “名称”属性的值必须为“备份”,操作员必须为“包含”
- Criteria 2: The value of the “owner” property must be “sa” and the operator must be “equals” 条件2: “所有者”属性的值必须为“ sa” ,而运算符必须为“等于”
See the following image:
见下图:

As you can see, SQL Jobs are filtered based on the given criteria.
如您所见,SQL Jobs是根据给定的条件过滤的。
Another example: Suppose we want to get the SQL Jobs those are categorized as “Database Maintenance” To filter those jobs; the value of “Category” property must be “Database Maintenance” See the following image:
另一个示例:假设我们要获取归类为“数据库维护”SQL作业,以筛选这些作业; “类别”属性的值必须是“数据库维护”,请参见下图:

As you can see, SQL Jobs are filtered based on the given criteria.
如您所见,SQL Jobs是根据给定的条件过滤的。
摘要 (Summary)
In this article, I have explained how we can apply a filter to identify the specific databases, database objects, and SQL Jobs in SSMS 2016.
在本文中,我已解释了如何应用过滤器来标识SSMS 2016中的特定数据库,数据库对象和SQL作业。
翻译自: https://www.sqlshack.com/how-to-filter-objects-in-ssms-2016/
ssms 2016