Solved

is table used by an views

Posted on 2015-01-30
6
39 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

707 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

13 Experts available now in Live!

Get 1:1 Help Now