Sample Header Ad - 728x90

SQL query to get the order of procedures based on their dependent procedures

1 vote
1 answer
668 views
i have this query to get all sp's and depending(nested) sp's on those sp's. I need to create all these procedures on another database . Any idea how to get them in the correct order. select distinct procs.NAME AS ProcedureName ,OBJDEP.NAME as DEP_ProcedureName_NAME FROM sysdepends INNER JOIN sys.objects OBJ ON sysdepends.ID = OBJ.OBJECT_ID INNER JOIN sys.objects OBJDEP ON sysdepends.DEPID = OBJDEP.OBJECT_ID inner join sys.procedures procs on sysdepends.id = procs.object_id where OBJDEP.type='P' AND OBJ.type='P'
Asked by Viz Krishna (109 rep)
Nov 24, 2022, 08:28 AM
Last activity: Nov 25, 2022, 07:04 AM