Dropping Tables with Cross-Database Referential Integrity Constraints

When you create a cross-database constraint, the SAP ASE server stores information in the sysreferences system table of each database.

Information Stored About Referential Integrity Constraints

Information Stored in sysreferences

Columns with Information About Referenced Table

Columns with Information About Referencing Table

Key column IDs

refkey1 through refkey16

fokey1 through fokey16

Table ID



Database name



Because the referencing table depends on information from the referenced table, the SAP ASE server does not allow you to:
  • Drop the referenced table,

  • Drop the external database that contains it, or

  • Use sp_renamedb to rename either database.

Use sp_helpconstraint to determine which tables reference the table you want to drop. Use alter table to drop the constraints before reissuing drop table.

You can drop a referencing table or its database. The SAP ASE server automatically removes the foreign-key information from the referenced database.

Each time you add or remove a cross-database constraint or drop a table that contains a cross-database constraint, dump both of the affected databases.

Warning!   Loading earlier dumps of these databases can cause database corruption. For more information about loading databases with cross-database referential integrity constraints, see the System Administration Guide.