Solved

Trace the links to a column in SQL (primary key)

Posted on 2011-09-21
5
161 Views
Last Modified: 2012-05-12
I wish to trace a link for a column (primary key) to see what other tables will be referencing it.

The reason for this is:
I have a problem with the way I entered the data into my sql DB.
I simply copy and pasted the data, which works fine until I insert a new data row through the software front end (Access Dimension) which crashes with a primary key dublication issue.
The old PK where pasted in and now when I get to an insert PK of 2 (the 2nd) it fails.

Alternatively a way to reset the PK value would suffice but the most common ways do not work as the field is a float.

any advise is very appriciated
0
Comment
Question by:dexterhome
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
mimran18 earned 250 total points
Comment Utility
Goto SSMS.
Select the table and right click on it
and select the view dependencies.
0
 
LVL 5

Author Comment

by:dexterhome
Comment Utility
Thanks for that mimran18.

This appears to show me the dependencies for the stock table which is a lot.
Can it be narrowed down to the column in any way?
0
 
LVL 9

Expert Comment

by:mimran18
Comment Utility
0
 
LVL 11

Assisted Solution

by:Simone B
Simone B earned 250 total points
Comment Utility
If the name of the key is consistent, eg the primary key for employee always appears as EmployeeID, then you should be able to find all related tables using the Information_Schema views.

Eg:

Use MyDatabase
go

Select * from INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME = 'EmployeeID'
0
 
LVL 5

Author Closing Comment

by:dexterhome
Comment Utility
thanks guys
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

772 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

12 Experts available now in Live!

Get 1:1 Help Now