Albert

I am using the latest build of 7.6.
I should have said I do have a PK, in fact the code below fails on both FK's with Temp Table but works when changed to a regular Table. Also, I have a Hist table that is the same structure
as this one with the same FK's.

I did a Unload all, still no luck with FK's on the Temp Table,
That is why I was wondering if they were allowed and I slept through class!

What am I missing?
Thanks Marc


CREATE TABLE Temp  `tran_spd`  (`custnum` INTEGER  ,  `date_con` +
DATE     ,  `tr_date` DATE     NOT +
NULL  ('Value for tr_date cannot be null.') ,  `tr_type` +
INTEGER  ,  `ch_code` TEXT    (8) ,  `ch_price` +
CURRENCY ,  `ptest` CURRENCY ,  `dig_ch` TEXT    (4) ,  `inscomp` +
TEXT    (3) ,  `cknum` TEXT    (15) ,  `date_frm` +
DATE     ,  `date_to` DATE     ,  `memo` +
TEXT    (100) ,  `treat_dr` TEXT    (2) ,  `INSHOLD` +
TEXT    (1) ,  `blddate` DATE     ,  `TranMod` +
TEXT    (30) ,  `ModF1` TEXT    (2) ,  `ModF2` +
TEXT    (2) ,  `ModF3` TEXT    (2) ,  `ModF4` TEXT    (2) )
CREATE     INDEX  ON `tran_spd` (`date_con` ASC )
CREATE     INDEX  ON `tran_spd` (`tr_type` ASC )
CREATE     INDEX  ON `tran_spd` (`ch_code` ASC )
CREATE     INDEX  ON `tran_spd` (`tr_date` ASC )

ALTER TABLE `tran_spd` ADD FOREIGN KEY ( `treat_dr` ) +
REFERENCES `DRINFO`

ALTER TABLE `tran_spd` ADD FOREIGN KEY ( `custnum` , `date_con` ) +
REFERENCES `PTDIAG` ('No Such linking Diag date.',+
'No Such linking Diag Date.')


--------------------------------------------------
From: "Albert Berry" <[email protected]>
Sent: Tuesday, March 16, 2010 1:57 AM
To: "RBASE-L Mailing List" <[email protected]>
Subject: [RBASE-L] - Re: Temp Tables

You must have a primary key on DRINFO before you can apply the FK on the temp table. I just tested, and I can apply the FK from the table designer, but get the same error message when I try to create it at the R> prompt.


MDRD wrote:
Hi
 Can you have a FK on a Temp Table?
 ALTER TABLE `tran_spd` ADD FOREIGN KEY ( `treat_dr` ) +
 REFERENCES `DRINFO`
I keep getting an error "referenced table does not exists.."
 Thanks
Marc





Reply via email to