McThuggets
Member
- Joined
- Sep 29, 2021
- Messages
- 27
- Reaction score
- 8
- Points
- 1,135
- Age
- 24
Hi everyone!
We have had a system in place for a number of years now that we want to rewrite. The crux of this system is this monstrous sql stored procedure that drives the system.
Over the years, various data fields and columns have been removed and added to the temporary tables in the SP but we have no record of which columns are actually required currently.
I have been given the task of going into this SP and noting down the tables and columns which are actually used... I am on day 5 of CTRL + F'ing my way through the stored procedure and noting down the fields being used. "I can finally see the finish line" I thought...
It has just dawned on me that we have about 6 other variations of this system for different clients that I will need to do all this for again.
There must be a programmatic way to do this but I am not really sure where to start. Any advice would be greatly appreciated.
* I did a quick google and found the SQL Server functions sp_depends and sys.dm_sql_referenced_entities() which may help. I will try to script something out with them tomorrow
We have had a system in place for a number of years now that we want to rewrite. The crux of this system is this monstrous sql stored procedure that drives the system.
Over the years, various data fields and columns have been removed and added to the temporary tables in the SP but we have no record of which columns are actually required currently.
I have been given the task of going into this SP and noting down the tables and columns which are actually used... I am on day 5 of CTRL + F'ing my way through the stored procedure and noting down the fields being used. "I can finally see the finish line" I thought...
It has just dawned on me that we have about 6 other variations of this system for different clients that I will need to do all this for again.
There must be a programmatic way to do this but I am not really sure where to start. Any advice would be greatly appreciated.
* I did a quick google and found the SQL Server functions sp_depends and sys.dm_sql_referenced_entities() which may help. I will try to script something out with them tomorrow