Click here to Skip to main content
15,905,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working in a huge project that has multiple schemas forked from an original database. I have used redgate to compare the schemas. I am looking for a tool that would let me analyze the table from their usage from C# (ADO.NET via stored procedures). Is there any such tool available?
Posted
Updated 26-Feb-15 9:01am
v2
Comments
ZurdoDev 26-Feb-15 16:56pm    
A tool to measure what exactly?
Karthik Swarna 26-Feb-15 18:31pm    
Hi Ryan,

Thank you for responding to my post.

I would like to see a map

1) Between each Stored Procedures and the Database tables it uses. This would give me an idea of all the tables that are used, more importantly tables that are not being used.
2) Between each stored procedure and the C# function that calls them in a given project . This would give me an idea of the stored procedure usage.

This is an esoteric request. I am working in a database with a huge system without any documentation. I am looking for a starting point to understand the database.

Thanks,
Karthik
ZurdoDev 26-Feb-15 19:49pm    
I've never heard of a product that can do that.
Karthik Swarna 26-Feb-15 19:58pm    
Thought so too. Just curious if there were any.

Thanks!
Tejas Vaishnav 27-Feb-15 3:45am    
Hey please check my answer, it might helpful for you.

1 solution

I think there will be no such type of tool available which check dependency of table and store procedure.

But with the help of sql query you can check like that, which table is used inside which store procedure or view or any function. so it might help full for you...

please use below query to get the output


SQL
DECLARE @vObjName VARCHAR(MAX) = 'XYZ';  ------> Change table name

SELECT DISTINCT
	obj.name AS Object_Name
	, obj.type_desc
FROM sys.sql_modules        module
	INNER JOIN sys.objects  obj ON module.object_id = obj.object_id
WHERE module.definition Like '%' + @vObjName + '%'
--	AND obj.type_desc NOT IN ('VIEW', 'SQL_SCALAR_FUNCTION', 'SQL_TABLE_VALUED_FUNCTION') -- uncomment this line to omit VIEW or SQL Funcation from result
ORDER BY 1


you will get list of store procedure, View and Function which will depend on your given table name
 
Share this answer
 
Comments
Tejas Vaishnav 27-Feb-15 1:14am    
If it will helpful to you, then please accept it as solution and don't forget to rate it.
Karthik Swarna 27-Feb-15 14:37pm    
Hi Tejas,

Thanks for the code. I understand that there are queries to link table with stored procedure. This is only part of what I am looking for. I am looking for a full blown tool. I appreciate your help in responding to my query.

Thanks,
Karthik

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