Joseph Morgan - asks HOW TO work with Foreign Keys?

Joseph Morgan joseph at checkos.com
Sun Oct 13 09:38:35 CDT 2013


Hi Ruslan,

I tried to create the link in Vstudio. 

Two Tables as example:

CREATE TABLE "Invoices1"(
	"InvoiceDate" DATE,
	"field1" ULONG,
	"rowID" ULONG METHOD ( 'RecID' ) );


CREATE TABLE "InvoiceItems"(
	"InvoiceKey" ULONG,
	"rowID" ULONG METHOD ( 'RecID' ) );


and the link:
-- CREATE LINK "lnk_Invoices1_InvoiceItems" --------------------
ALTER TABLE "Invoices1" ADD CONSTRAINT "lnk_Invoices1_InvoiceItems" 
	FOREIGN KEY( "field1" )
	REFERENCES "InvoiceItems" ( "InvoiceKey" )
	ON DELETE RESTRICT 
	ON UPDATE SET DEFAULT;
-- -------------------------------------------------------------


Creating the link gets the following error:
 09:16:57 Kernel error: 0x23508. Primary key constraint violation occurred, table name = "InvoiceItems", constraint name = "lnk_Invoices1_InvoiceItems".

I am sure I am doing something wrong. But what is it?


Thank you,
Joseph

On Oct 13, 2013, at 4:53 AM, Ruslan Zasukhin <ruslan_zasukhin at valentina-db.com> wrote:

> On 10/12/13 4:45 PM, "Joseph Morgan" <joseph at checkos.com> wrote:
> 
> Hi Joseph,
> 
> I have start a new thread with clean question.
> 
>> But, How is the foreign key thing done. I have checked the wiki and attempted
>> in vstudio but it's not working.
> 
> Well, may be you can try describe what you want and what you tried?
> 
> -- 
> Best regards,
> 
> Ruslan Zasukhin
> VP Engineering and New Technology
> Paradigma Software, Inc
> 
> Valentina - Joining Worlds of Information
> http://www.paradigmasoft.com
> 
> [I feel the need: the need for speed]
> 
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina



More information about the Valentina mailing list