How do I search an SQL Server database for a string?(如何在 SQL Server 数据库中搜索字符串?)
问题描述
我知道这是可能的,但我不知道怎么做.
I know it's possible, but I don't know how.
我需要在 SQL Server 数据库中搜索所有提及特定字符串的内容.
I need to search an SQL Server database for all mentions of a specific string.
例如:我想搜索所有表、视图、函数、存储过程...以查找字符串tblEmployes"(不是表中的数据).
For example: I would like to search all tables, views, functions, stored procedures, ... for string "tblEmployes" (not data within the tables).
我需要这个的原因之一是我想删除一些创建的额外数据表,但我担心它们可能在过程或函数的某处使用.
One of the reasons I need this is I would like to remove some extra data tables that are created, but I am afraid that they are maybe used somewhere in procedures or functions.
推荐答案
这将搜索特定数据库中每个表的每一列.在要搜索的数据库上创建存储过程.
This will search every column of every table in a specific database. Create the stored procedure on the database that you want to search in.
十个最常见的 SQL Server 问题及其答案:
要运行它,只需执行以下操作:
To run it, just do this:
效果非常好!!!
这篇关于如何在 SQL Server 数据库中搜索字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!