如何在SSMS结果中搜索字符串/子字符串? [英] How to search for a string/substring in SSMS results?
问题描述
这似乎很简单,但是由于某种原因,我没有找到有关该操作的任何信息.我正在使用SQL Server Management Studio 2012,并且从SELECT查询(例如select a,b from x
)返回了一组结果.如何在b
列中搜索子字符串?在Access中,我将单击该列并键入Ctrl + F,但是在SSMS中,该似乎仅用于搜索SQL本身,而不是搜索结果.如何搜索结果?我知道我可以修改查询以仅返回该结果,例如:
This seems pretty straightforward, but for some reason I'm not finding anything about how to do it. I'm using SQL Server Management Studio 2012, and I have a set of results returned from a SELECT query, say, select a,b from x
. How can I search in column b
for a substring? In Access I would click on the column and type Ctrl+F, but in SSMS that seems to only be used for searching the SQL itself, not the results. How can I search in my results? I know I can modify my query to only return that result, e.g.:
select a,b from x where b like '*hello*'
但是我想返回所有的行,而不仅仅是那一行.
but I want to get all the rows returned, not just that one.
更新:我得到的响应是关于如何建立一个查询,该查询仅选择我要查找的行,正如我在上面指定的那样,这不是我要查找的行.我希望返回所有行,并且想在SSMS界面的搜索结果中四处查找以找到所需的值.原因是我想在其他没有它们的行的上下文中查看这些值.
UPDATE: The responses I'm getting are about how to build a query that selects only the rows I'm looking for, which, as I specified above, is not what I'm looking for. I want all rows returned, and I want to look around in the search results in the SSMS interface to find the desired values. The reason is that I want to see these values in the context of other rows that don't have them.
推荐答案
在SQL Server Management Studio中,您可以将查询结果输出为文本(CTRL + T),重新运行查询,在结果窗格中单击,然后CTRL + F从未过滤的查询中查找字符串.要将查询结果还原为网格,请按CTRL + D.
In SQL Server Management Studio, you can output your query results to text (CTRL + T), re-run your query, click in the results pane, and CTRL + F to find strings from an unfiltered query. To revert query results to grid, hit CTRL + D.
这篇关于如何在SSMS结果中搜索字符串/子字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!