• something that might help a little bit:

    if you create a procedure that references a non-sys object in another database, you can find it via the sys.dm_sql_referenced_entities() function

    here's an example...the server/database/table actually exists as a linked server on my system:

    note how it does NOT find the proc that is referencing sys.tables, for example...a search of the sys.sql_modules (better than syscomments) would find it...but that also could give a false positive if the server name is in a comment.

    CREATE PROCEDURE pr_sample

    AS SELECT * FROM DBSQL2K5.master.sys.tables

    --a real table:

    CREATE PROCEDURE pr_sample2

    AS SELECT * FROM DBSQL2K5.DEMO1000.dbo.GMACT

    SELECT objz.name,

    fn.*

    FROM sys.objects objz

    CROSS APPLY sys.dm_sql_referenced_entities(schema_name(schema_id) + '.' + objz.name,'OBJECT')fn

    where name LIKE 'pr_sample%'

    /*

    name referencing_minor_id referenced_server_name referenced_database_name referenced_schema_name referenced_entity_name referenced_minor_name referenced_id referenced_minor_id referenced_class referenced_class_desc is_caller_dependent is_ambiguous

    ------------- -------------------- ----------------------- -------------------------- ---------------------- ----------------------- ---------------------- ------------- ------------------- ---------------- ---------------------- ------------------- ------------

    pr_sample2 0 DBSQL2K5 DEMO1000 dbo GMACT NULL NULL 0 1 OBJECT_OR_COLUMN 0 0

    */

    SELECT objz.name,

    fn.*

    FROM sys.objects objz

    CROSS APPLY sys.dm_sql_referencing_entities(schema_name(schema_id) + '.' + objz.name,'OBJECT')fn

    where name LIKE 'pr_sample%'

    /(no results*/

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!