foreign key constraint
Bernard Devlin
bdrunrev at gmail.com
Mon Jan 25 12:43:44 CST 2010
Ivan, I think we may be at cross-purposes here.
On Mon, Jan 25, 2010 at 3:41 PM, Ivan Smahin
<ivan_smahin at paradigmasoft.com> wrote:
> Hello Bernard,
>
> Monday, January 25, 2010, 1:48:55 PM, you wrote:
>
>> ALTER TABLE Phone(
>> ADD CONSTRAINT 'link_Person_Phone'
>> FOREIGN KEY (PersonPtr) REFERENCES Person(ID)
>> ON DELETE SET NULL
>> ON UPDATE SET NULL )
>
>> The above is from the Valentina wiki. Is that right? When I try to
>> use the SQL Editor in VStudio, it complains about unexpected tokens.
>
> CREATE TABLE t1 ( id long unique );
> CREATE TABLE t2 ( ptr long indexed );
>
> ALTER TABLE t2 ADD CONSTRAINT FK_t2_t1 FOREIGN KEY (t2.ptr) REFERENCES
> t1(id) ON DELETE SET NULL ON UPDATE SET NULL;
>
> Really, get a syntax error...
>
> but it works for ...FOREIGN KEY (ptr)...
> Ok - will be fixed.
I think you are saying that this does work:
FOREIGN KEY (ptr) REFERENCES
but this does not work:
FOREIGN KEY (t2.ptr) REFERENCES
I was questioning the correctness of the example from the wiki. There
seem to be various things wrong with the example I cited: the whole
ALTER TABLE statement cannot be bracketed, and the constraint cannot
have quotation marks in it.
http://valentina-db.com/dokuwiki/doku.php?id=valentina:vcomponents:vkernel:vlink:foreign_key&s[]=foreign&s[]=key
Regards, Bernard
More information about the Valentina
mailing list