How to search for a specific string in all columns within all tables of a SQL Server database?

后端 未结 3 443
北荒
北荒 2021-01-28 16:30

We want to search for a string (ie. \"Hello World\") in all our database that has about 120 tables. We thought about doing a dump like mysql dump but it came out in a weird bak

3条回答
  •  春和景丽
    2021-01-28 17:05

    No it possible and easy to write a script to do this.

    Suggestions: I think you have to use some cursors and use some of these objects to write your script

    1. sys.databases
    2. INFORMATION_SCHEMA.TABLES or sys.tables
    3. INFORMATION_SCHEMA.COLUMNS or sys.columns

    Once you have these things in place, searching Hello World under all columns would be more simple

提交回复
热议问题