Subject | Re: [firebird-support] Re: Error creating table with foreign key |
---|---|
Author | Martijn Tonies |
Post date | 2005-10-05T12:41:37Z |
Hello Adrian,
Here's a snipper from the documentation:
col_constraint = [CONSTRAINT constraint]
{ UNIQUE
| PRIMARY KEY
| REFERENCES other_table [(other_col [, other_col .])]
[ON DELETE {NO ACTION|CASCADE|SET DEFAULT|SET NULL}]
constraints after defining all columns.
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> > > Did I miss something ?Not here though...
> >
> > Yes. The right syntax, for example ;-)
> >
> > From the top of my head:
> >
> > ... REFERENCES T1 (P1)
> >
>
> Sorry, but that doesn't make a difference.
> I checked several help files for the syntax of Create Table.
> Somehow they all use this example, and they all write T1.P1
Here's a snipper from the documentation:
col_constraint = [CONSTRAINT constraint]
{ UNIQUE
| PRIMARY KEY
| REFERENCES other_table [(other_col [, other_col .])]
[ON DELETE {NO ACTION|CASCADE|SET DEFAULT|SET NULL}]
> I just tried T1 (P1), but get the same error.Remove the "foreign key" part -- this is only used when writing
constraints after defining all columns.
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com