Wodka40[Google] <martekpr...@gmail.com> писал(а) в своём письме Mon, 06  
Dec 2010 17:30:47 +0600:

> (First of all sorry for my "inglish")
>
> 3 tables :
> Owners
> Models
> Cars
>
> My difficult is recreate a kind of "referential integrity" through FK
>
> With 2 tables not problem but with 3  cascade table .....
>
> Owner:  PK IDowner
> Models: PK IDmodel
>
> Cars: CodOwner CodModel
>
> IDowner 1-> many CodOwner
> IDmodel 1-> many CodModel
>
> I write
> CREATE TABLE [Models] (
>   [IDcar] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
>   [CODmodel] INTEGER NOT NULL CONSTRAINT [FKmodel] REFERENCES [Models]
> ([idmodel]) ON DELETE NO ACTION,
>   [CODowner] INTEGER NOT NULL CONSTRAINT [FKowner] REFERENCES [Owners]
> ([Idowner]) ON DELETE NO ACTION,
>   [DataImmatricolazione] DATE,
>   [Targa] NVARCHAR(20) NOT NULL);
>
> But not works!!!
> message:
> Abort due to constraint violation.
>
> if delete one fk (random) and ....ta dah!... no error but incomplete
> simulation of "referential integrity" with 3 linked tables!

CREATE TABLE [Models] ... REFERENCES [Models] ?

Isn't is a recursive reference?

Regards,
Serge

----
Serge Igitov
http://www.phpc.ru
Want to make it support SQLite! :P
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to