Search a column name across all databases

后端 未结 6 1760
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-05 12:21

I have this query that finds all tables and views that matches my column name of a certain database. I am using SQL SERVER 2008

SELECT table         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-05 13:00

    You can use this query for find field name that used in SP/View or Function

    SELECT 
        OBJECT_NAME(object_id) as 'Procedure/Function/View Name',
        definition
        --,*
    FROM sys.sql_modules
    WHERE 
        ( definition LIKE '%' + '' + '%' )
    

提交回复
热议问题