I'm trying to get a consolidated sql file by reading all the .proc(Sybase stored procedure) files at a directory using PowerShell. While doing so, it is required to maintain their order as per dependencies to avoid any "stored procedure not found error" while deployment.
My current logic loops in all the files looking for a Sp name, when found I keep it in a ArrayList. If any dependency is found and is already in my array, i would insert it at one position before the dependent stored procedure. But this identifies 1-1 relationship between them,and does not resolves all the dependencies.
Expected result is a consolidate file which can be deployed on database.