Search code examples
foreign-keyssap-ase

Sybase: how do I create data that violates foreign key contraint


I have an existing database with several rows that violate a foreign key constraint. How do I script this situation in a new database?

I believe some databases can create constraints that do not validate pre-existing data but cannot find this option in Sybase 12.

Sybase ASE 12.5


Solution

  • Adding a constraint doesn't validate against existing data. So drop it, bob some garbage in and put it back...