Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have interesting task. We are using a bunch of tables filled with data we don’t use anymore. Problem is I don’t have documentation for applications used in the past with our SQL Server tables so I must manually locate unused column data. Is there some tool out there to do this job for me?
Posted
Comments
Sergey Alexandrovich Kryukov 11-May-13 1:31am    
This is fully depends on your definition of "use".
—SA

I agree it is almost impossible.If you have queries like select * used in your application than you cant just go and delete data ....
First you need to examine your application code. This can be time consuming, but it is a good place to start. Finding all references for each column...
You can do a profiling for tables you want to clean. Just let it run few days and than examine logs.

The only tool i know for this is http://www.red-gate.com/products/sql-development/sql-dependency-tracker/[^]
It can find all "orphan" objects.
 
Share this answer
 
I think that, given enough time, I could proof that in general case this is theoretically impossible. But I can give you the idea:
http://en.wikipedia.org/wiki/Halting_problem[^].

Are you getting the picture? You may have some "dead code" in your application, which uses some columns but is never actually called. It is theoretically impossible to proof that it is called (or not), which can be proven as a consequence of halting problem. Practically, this is even harder.

In principle, you could do much weaker statements: you could eliminate the columns with names which are not hard-coded in the product. In other words, it can help only some sloppy products and still cannot 100% guarantee that the functionality is not broken. And I would not expect that anyone would be developing a tool like that.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900