How do I search an SQL Server database for a string?

后端 未结 15 1688
执念已碎
执念已碎 2020-11-28 18:40

I know it\'s possible, but I don\'t know how.

I need to search an SQL Server database for all mentions of a specific string.

For example: I would like t

15条回答
  •  粉色の甜心
    2020-11-28 19:02

    You can also try ApexSQL Search – it’s a free SSMS add-in similar to SQL Search.

    If you really want to use only SQL you might want to try this script:

    select
    S.name as [Schema],
    o.name as [Object],
    o.type_desc as [Object_Type],
    C.text as [Object_Definition]
    from sys.all_objects O inner join sys.schemas S on O.schema_id = S.schema_id
    inner join sys.syscomments C on O.object_id = C.id
    where S.schema_id not in (3,4) -- avoid searching in sys and INFORMATION_SCHEMA schemas
    and C.text like '%ICE_%'
    order by [Schema]
    

提交回复
热议问题