Solved

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

Posted on 2011-09-21
5
167 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

840 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