Solved

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

Posted on 2011-09-21
5
163 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
ID: 36573592
Goto SSMS.
Select the table and right click on it
and select the view dependencies.
0
 
LVL 5

Author Comment

by:dexterhome
ID: 36574016
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
ID: 36575758
0
 
LVL 11

Assisted Solution

by:Simone B
Simone B earned 250 total points
ID: 36575830
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
ID: 36933406
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.

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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 setup several different housekeeping processes for a SQL Server.

943 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

4 Experts available now in Live!

Get 1:1 Help Now