Solved

is table used by an views

Posted on 2015-01-30
6
40 Views
Last Modified: 2015-03-03
At some point, when I first started working with SQL Server, I got the idea that it might be beneficial to take several Access databases and migrate the data to SQL Server.  I had a set of tables which were common to several Access applications, so I figured I would put them into their own SQL Server database, but after a while I realized that separating the data from the Access applications was more trouble than it was worth, so I copied all of those tables into one database.

So, before I delete that common tables database, I would like to know if there is an easy way to identify object relationships within SQL Server.  Specifically, I need to know whether any of the tables in that database are being used in any of the views, stored procedures, or UDFs in either that database, or any of the other databases on that server.
0
Comment
Question by:Dale Fye (Access MVP)
  • 3
  • 2
6 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40580692
In SSMS, click on table, then Right-click > View Dependancies > Objects that depend on [your table name]

Guessing there are a number of third-party tools, probably Redgate and Pragmatic Works DOCxPress, that have this automated in such a way that it'll generate for all objects.
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 40580695
Starting with SQL 2008, you can use this view:

sys.sql_expression_dependencies
0
 
LVL 47

Author Comment

by:Dale Fye (Access MVP)
ID: 40610127
Thanks, Jim.  That seems to work within a given database, but not across databases on the same server.

Scott,  can you provide an example of how to use that?  I've tried a couple of things, but nothing seems to work.

Dale
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 40610173
Correct.  SQL databases don't track outside-database dependancies.  That's kind of like saying 'List all the people in the world that have my phone number', there's no way of knowing unless you track it manually.

Pragmatic Works Doc xPress does this, but you have to load all of the db's / SSIS / SSRS / SSAS into 'the world' for it to tell you were the dependancies lie.

Of course, you can always rename the database and see who screams.

Good luck.
0
 
LVL 47

Author Closing Comment

by:Dale Fye (Access MVP)
ID: 40642706
Thanks for that recommendation, JIm.  I'm going to use one of the several 3rd party apps.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40642720
If you go with Pragmatic Works mention that I went bull riding at Cowboy Jack's in Minneapolis with Brian Knight and Graham Bless, and referred you to them.  Guessing it won't get you anything other than a couple of good yuks, although it'll keep me on their good side.

Thanks for the grade.  Good luck with your Easter Egg hunt.  -Jim
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now