views:

66

answers:

1

I've been handed a C# codebase that uses a SQL Server 2005 database. I would like to have an overview which database tables and procedures are accessed by which method bodies in the code; in the case of tables, I would also like to know the type of access (CREATE, DROP, SELECT, INSERT, UPDATE or DELETE). String searching for these keywords and table/procedure names would get me a long way except that the code makes very little use of bare SQL, mostly using DataSets and DataAdapters and who knows what else.

This is not the first time I've been in this situation (with varying languages and DBMSes).

Which tools exist to help me with this task? Can you recommend an improvement on my string searching idea?

PS: There is another question on SQL Server dependencies with some relevant answers.

+2  A: 

sql server profiler. it will log every single call along with the procedure text ... and then you can export the profile trace to a table and query upon it :-)

http://msdn.microsoft.com/en-us/library/ms187929.aspx

Joel Martinez
Hmmm ... very helpful, thanks, but I'd like to have something for which I don't need to run the application. Even if I get it up and running I have no way of knowing how to run it in order to cover all the database access that is in there.
reinierpost
@reinierpost: I understand why you want to do that, but that isn't really possible. (It's equivalent to the halting problem)
SLaks
@SLaks: only if you want a perfect solution. I'm happy with anything that makes a good stab in the right direction.
reinierpost