finding constraint problems

finding constraint problems

Post by Rich Westcot » Tue, 29 Dec 1998 04:00:00



Hello,
        I am trying to add a foreign key and the thing tells me that there are
values that fail the constraint.
        I was wondering if someone could tell me how to manually check for
these out of bounds values
        I was trying things like
select name from names, namekey where NOT names.nameid = namekey.nameid

this didn't work

anyways I want to find these problematic values for manual removal

        Thanks
        Rich


 
 
 

finding constraint problems

Post by Chas Colema » Tue, 29 Dec 1998 04:00:00


You might try a subquery that returns the records you want, ie

Select Namekey.nameid from Namekey

This returns all VALID pk/fk values.

NOW SELECT the values in your current file (Names) that don't match the
values in this recordset, ie,

Select Names.Nameid NOT IN (Select namekey.nameid from NameKey)

This will work if the Datatypes are compatible (remember, SQL is alot
fussier than Access about doing implicit conversions of datatypes,
especially within an expression)

-----Original Message-----

Newsgroups: microsoft.public.sqlserver.programming
Date: Monday, December 28, 1998 11:08 AM
Subject: finding constraint problems

>Hello,
> I am trying to add a foreign key and the thing tells me that there are
>values that fail the constraint.
> I was wondering if someone could tell me how to manually check for
>these out of bounds values
> I was trying things like
>select name from names, namekey where NOT names.nameid = namekey.nameid

>this didn't work

>anyways I want to find these problematic values for manual removal

> Thanks
> Rich




 
 
 

1. Finding constraints programmatically

I am constructing several sql sp's to automate the reconfiguration of
several tables in a database. I can automate most of the structures and
properties of the files, but I don't know how to iterate through the
constraints that may exist on each table. I know it is possible to do this
using the system tables. Does anyone know how?

Gary

2. Problem adding records to views from Access front end

3. Finding Not Null Constraints

4. US-MT-GOV'T FINANCIAL PROJECT

5. How can i find all the user constraints of database

6. Installing OpenIngres as a user different from "ingres"

7. Find Default Constraint names

8. Need a good book

9. Finding constraint

10. Find check constraints given Table and Column

11. Finding info on Constraints

12. SQL to Find Referencial Integrity Constraints

13. Could not find CHECK constraint??