SQL to Find Referencial Constraint Violations? 
Author Message
 SQL to Find Referencial Constraint Violations?

I'm trying to figure out what records in a table are causing a referencial
constraint violation when I try to move some data. My problem is that I have
a multipart foreign key so I need to find out what records in Table A don't
exist in Table B where (A.1, A.2, A.3) = (B.1, B.2, B.3). I need to be able
to do this with an SQL statement.


Mon, 10 Dec 2001 03:00:00 GMT  
 SQL to Find Referencial Constraint Violations?
try some outer joins like:

select A.*
from A left join B on (A.1, A.2, A.3) = (B.1, B.2, B.3)
where B.1 is null

</wqw> - MCSD


Quote:
>I'm trying to figure out what records in a table are causing a referencial
>constraint violation when I try to move some data. My problem is that I
have
>a multipart foreign key so I need to find out what records in Table A don't
>exist in Table B where (A.1, A.2, A.3) = (B.1, B.2, B.3). I need to be able
>to do this with an SQL statement.



Tue, 11 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SP blows on constraint violation

2. Foreign Constraints violation in Shaped RS

3. A constraint violation occurred

4. SQL CONSTRAINT Clause

5. vb .net an sql server constraint messages

6. ADD CONSTRAINT SQL

7. sql server constraints

8. 2nd try - setting pk constraint using SQL-DMO

9. sql server Constraints

10. Add Constraint - Sql Guru required : )

11. SQL 7 Check constraints

12. Access Violation using Prepared SQL

 

 
Powered by phpBB® Forum Software