2017-12-12 3 views

답변

1

는 저장 프로 시저가 다음 스크립트는

SELECT m.object_id,o.name,c.*,o.type,o.type_desc FROM sys.all_sql_modules AS m 
    INNER JOIN sys.objects AS o ON o.object_id=m.object_id 
    OUTER APPLY(

     SELECT 
      coalesce(object_schema_name(Referencing_ID)+'.','')+ --likely schema name 
      object_name(Referencing_ID)+ --definite entity name 
      coalesce('.'+col_name(referencing_ID,referencing_minor_id),'') 
       AS [referencing], 
      coalesce(Referenced_server_name+'.','')+ --possible server name if cross-server 
       coalesce(referenced_database_name+'.','')+ --possible database name if cross-database 
       coalesce(referenced_schema_name+'.','')+ --likely schema name 
       coalesce(referenced_entity_name,'') + --very likely entity name 
       coalesce('.'+col_name(referenced_ID,referenced_minor_id),'')AS [referenced] 
     FROM sys.sql_expression_dependencies 
     WHERE referencing_id =m.object_id 

    ) AS c 
    WHERE o.type='P' 
    AND c.referencing IS NULL 
+0

안녕 놀란, 큰 SQL 쿼리에 대한 도움이되는 데이터베이스의 참조 데이터 오브젝트를? 있던 알고 싶지 않아! 참고로, 데이터베이스 객체를 참조하는 SP가 마지막으로 cluase 조건은 "c.referencing IS NOT NULL"이 될 것입니다. – Eralper