By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

Alter Table statment: adding foreign key WITHOUT referential integrity

P: n/a
Is there a way to run an alter table statement that adds a constraint
for a foreign key, but does *not* check the existing data for
refrential integrity? I'm essentially looking for the equivalent to SQL
Server's NOCHECK flag.

I am able to create equivalent keys in the Relationships screen, as
long as the "Enforce referential integrity" box is left unchecked. But
when I try to create that relationship with an ALTER TABLE statement, I
always get an error like:

"Cannot create relationships to enforce referential integrity.
Existing data in table 'tblSubcontracts' violates referential integrity
rules in table 'tbl_AgmtFormat'."

Is there a clause I can add to my ALTER TABLE statement to get around
this?

Thanks,
Moskie

Jul 12 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I should add I'm using MS Access 2003.

mos...@gmail.com wrote:
Is there a way to run an alter table statement that adds a constraint
for a foreign key, but does *not* check the existing data for
refrential integrity? I'm essentially looking for the equivalent to SQL
Server's NOCHECK flag.

I am able to create equivalent keys in the Relationships screen, as
long as the "Enforce referential integrity" box is left unchecked. But
when I try to create that relationship with an ALTER TABLE statement, I
always get an error like:

"Cannot create relationships to enforce referential integrity.
Existing data in table 'tblSubcontracts' violates referential integrity
rules in table 'tbl_AgmtFormat'."

Is there a clause I can add to my ALTER TABLE statement to get around
this?

Thanks,
Moskie
Jul 12 '06 #2

P: n/a
mo****@gmail.com wrote:
Is there a way to run an alter table statement that adds a constraint
for a foreign key, but does *not* check the existing data for
refrential integrity? I'm essentially looking for the equivalent to SQL
Server's NOCHECK flag.

I am able to create equivalent keys in the Relationships screen, as
long as the "Enforce referential integrity" box is left unchecked. But
when I try to create that relationship with an ALTER TABLE statement, I
always get an error like:

"Cannot create relationships to enforce referential integrity.
Existing data in table 'tblSubcontracts' violates referential integrity
rules in table 'tbl_AgmtFormat'."
I don't know of any. If I needed to do this I would try FOREIGN KEY NO
INDEX. I am !!!!!!guessing!!!!! that if there is no Index JET may not
have any way of checking existing data. I am also guessing this has 5%
chance of being successful.

Jul 13 '06 #3

P: n/a
On 12 Jul 2006 15:37:26 -0700, mo****@gmail.com wrote:

Add a new Relation object using DAO. The help file has details.
You know that an unenforced relation has no real value, right?

-Tom.
>Is there a way to run an alter table statement that adds a constraint
for a foreign key, but does *not* check the existing data for
refrential integrity? I'm essentially looking for the equivalent to SQL
Server's NOCHECK flag.

I am able to create equivalent keys in the Relationships screen, as
long as the "Enforce referential integrity" box is left unchecked. But
when I try to create that relationship with an ALTER TABLE statement, I
always get an error like:

"Cannot create relationships to enforce referential integrity.
Existing data in table 'tblSubcontracts' violates referential integrity
rules in table 'tbl_AgmtFormat'."

Is there a clause I can add to my ALTER TABLE statement to get around
this?

Thanks,
Moskie
Jul 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.