David Sillswrote:

> 
> To whom it may concern:
> 
> This is my first attempt at using this listserv, so
> forgive any errors in execution.
> 
> I'm trying to establish a referential integrity
> constraint between two tables in a recently-created
> database in SAP DB 7.4 on Windows XP Professional. I'm
> using the Database Manager GUI. This appears, from the
> description in the SAP DB library and downloaded PDF,
> to be very simple. However, I can't get it to work at
> all; my implementations are simply ignored.
> 
> I have a CAT database with a mapping table:
> 
> CREATE TABLE WORK_ON_CD
> (
>   ID Integer,
>   CD_ID Integer,
>   WORK_ON_ID Integer
>   PRIMARY KEY(ID)
>   FOREIGN KEY FK_1 CD_ID references CD
>   FOREIGN KEY FK_2 WORK_ID reference WORK
> )
> 
> Both foreign keys reference ID columns in the
> referenced tables, which is pretty ordinary.
> 
> How can I get this to work? I've tried to D&D the
> tables, but the primary key columns are not there to
> be selected. And it ignores me if they're not there.

1. At least there are comma missing in the statement given above,
 CREATE TABLE WORK_ON_CD
(
  ID Integer,
  CD_ID Integer,
  WORK_ON_ID Integer        ,
  PRIMARY KEY(ID)      ,
  FOREIGN KEY FK_1 CD_ID references CD       ,
  FOREIGN KEY FK_2 WORK_ID reference WORK
)

2. Which column shall reference to the other tables ?

if you say      xyz <datatype>  ... references <tablename>
the kernel knows which column has to be used for that foreign key.
But in your create table no column out of table WORK_ON_CD
is mentioned to be the referencing column. This can't do.

3. We do not know your tables CD and WORK used in the
reference clause.

If both have exactly one primary key column with the datatype
of the referencing column (see 2.) then it will work.
If there is no primra ykey column (or not exactly one or with
different datatype) a referenced column has to be specified
which has to have a unique index in the table CD / WORK.

Elke
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to