SQL to list all Procs using TABLE abc or VIEW xyz

  • Need some sql to list all PROCS which use TABLE "abc" or VIEW "xyz"

    thx in advance 

    BT
  • Assuming your dependencies are in order you can query sysobjects and sysdepends... something like this should work:

    SELECTso2.name

    FROMsysobjects so

    JOINsysdepends sd

    ONso.id = sd.depid

    JOINsysobjects so2

    ONsd.id = so2.id

    WHEREso.name = 'table_or_view_name'

    ANDso2.xtype = 'P'

Viewing 2 posts - 1 through 1 (of 1 total)

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