I am using 9.5 (32).. I think the same.
An opportunity to improve, because temporary table is very usefully to enter data using a form. Thanks. Juan From: [email protected] [mailto:[email protected]] On Behalf Of Karen Tellef Sent: jueves, 14 de febrero de 2013 04:54 p.m. To: RBASE-L Mailing List Subject: [RBASE-L] - Re: Create FK in temporary table You don't mention what version you're using. I just fired up 9.5 and created a temp table and then an FK on it and I got an error. I fired up an old copy of 6.5 and it doesn't work there either, so I assume this has never worked. Karen -----Original Message----- From: Juan Otazú <[email protected]> To: RBASE-L Mailing List <[email protected]> Sent: Thu, Feb 14, 2013 1:42 pm Subject: [RBASE-L] - Re: Create FK in temporary table Thanks Karen, first I tried this process, the same error. CREATE TEMPORARY TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT NULL+ ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT NULL + ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL + ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40, + artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior) + ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), CHECK (material_actual <> + material_anterior)) ALTER TABLE tdexpara_cambios ADD FOREIGN KEY (material_actual) REFERENCES + sap_material All the PK and Rules definition works in temporary table except the FK. (At least for me). This could be a issue? Thanks Juan From: [email protected] [mailto:[email protected] <mailto:[email protected]?> ] On Behalf Of Karen Tellef Sent: jueves, 14 de febrero de 2013 04:14 p.m. To: RBASE-L Mailing List Subject: [RBASE-L] - Re: Create FK in temporary table I've never tried to create a FK on a temp table so can't tell you if that works or not. But you can create the temp table first and then use the alter command to add the FK afterwards. See if that works. Here's an example: ALTER TABLE mpsinvoice ADD FOREIGN KEY (vendornum) REFERENCES vendors Karen -----Original Message----- From: Juan Otazú <[email protected]> To: RBASE-L Mailing List <[email protected]> Sent: Thu, Feb 14, 2013 1:05 pm Subject: [RBASE-L] - Create FK in temporary table Hi to all, I need to create a temporary table to enter data into a form and validate some PK, FK rules. This command work fine: CREATE TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT NULL + ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT NULL + ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL + ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40, + artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior) + ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), FOREIGN KEY + (material_anterior) REFERENCES sap_material + ('MATERIAL ANTERIOR NO EXISTE EN SAP'), FOREIGN KEY (material_actual) + REFERENCES sap_material ('MATERIAL ACTUAL NO EXISTE EN SAP'), CHECK + (material_actual <> material_anterior)) It is a regular table. But this do not work: CREATE TEMPORARY TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT NULL+ ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT NULL + ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL + ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40, + artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior) + ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), FOREIGN KEY + (material_anterior) REFERENCES sap_material + ('MATERIAL ANTERIOR NO EXISTE EN SAP'), FOREIGN KEY (material_actual) + REFERENCES sap_material ('MATERIAL ACTUAL NO EXISTE EN SAP'), CHECK + (material_actual <> material_anterior)) The message say: -ERROR- The referenced table does not exist. (2801) Do not create the temporary table. The only one change has been add "temporary" to line 1. Some issues to connect temporary FK to regular PK ? Thanks in advance. R:egards Juan Otazú R:Base 9.5 (32)

