Find an object in SQL Server (cross-database)

后端 未结 10 1198
太阳男子
太阳男子 2021-02-01 16:52

If I\'ve been told a table (or proc) name, but not which connected database the object is located in, is there any simple script to search for it? Maybe search somewhere in the

10条回答
  •  悲&欢浪女
    2021-02-01 17:31

    SELECT NAME AS ObjectName
        ,schema_name(o.schema_id) AS SchemaName, OBJECT_NAME(o.parent_object_id) as TableName
        ,type
        ,o.type_desc
    FROM sys.objects o
    WHERE o.is_ms_shipped = 0
        AND o.NAME LIKE '%UniqueID%'
    ORDER BY o.NAME
    

提交回复
热议问题