Script to find parent procedure

  • declare @objid as int

    select @objid=object_id from sys.objects where name='substitute your Procedurename'

    if exists(select id from sysdepends where depid=@objid)

    begin

    select name as ParentProcedure from sys.objects where object_id in

    (select id from sysdepends where depid=@objid)

    end

    else

    begin

    print 'No Parent Procedure Found'

    end

    will this work?Plz reply

  • You can use the below to find out the parent procedure

    SELECT*

    FROMsys.dm_sql_referencing_entities('dbo.' + @ChildProcedureName ,'OBJECT')

  • Duplicate post. No replies please.

    Original post: http://qa.sqlservercentral.com/Forums/FindPost1245459.aspx

    @deepikamm: Is there any specific reason for starting a new thread with the very same question?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • didnt get reply for >2 days.thats y posted it here.

    Thanks for replying..!

  • Sorry But your Question ,As i thought something strange ,You want some one to just run a Query for you!

    :w00t:

  • I wanted someone to confirm that the query posted by me will display parent procedure.

  • deepikamm (2/2/2012)


    declare @objid as int

    select @objid=object_id from sys.objects where name='substitute your Procedurename'

    if exists(select id from sysdepends where depid=@objid)

    begin

    select name as ParentProcedure from sys.objects where object_id in

    (select id from sysdepends where depid=@objid)

    end

    else

    begin

    print 'No Parent Procedure Found'

    end

    will this work?Plz reply

    Yes it should work. Have you tested it with some sample ??

    Ooops, Its already resolved right ?


    Sujeet Singh

  • yes i tested it.It worked fine.Before using it,i wanted sqlexperts to check and confirm the script.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply