Solved

is table used by an views

Posted on 2015-01-30
6
42 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:Scott Pletcher
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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
backup and restore 21 30
Transact SQL - Frequency of Length of Distinct Values 3 26
SQL View / Qtry 3 13
SQL - Simple Pivot query 8 15
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…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

821 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