Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

749 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