Subject | Re: [firebird-support] Error creating table with foreign key |
---|---|
Author | Martijn Tonies |
Post date | 2005-10-05T06:18:14Z |
Hello Adrian,
From the top of my head:
... REFERENCES T1 (P1)
Mind you, I hardly ever enter SQL ;-)
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
> I have installed fb1.5.2 on XP Home and have been trying to write somecode
> that creates a db.it.
> I use Delphi 6 Pro for that and the Interbase components that come with
> I got started just fine with the first table and then ran into problemswhen
> creating a table with a foreign key.the
> The sql statement I was executing wasn't that different from the one in
> help file(s) I found (like Interbase SQL Reference - Create Table).Employee db
> So I tried to execute the help-file statements through isql on the
> that comes with fb.--
> But I still get the same strange error:
>
> --------------------------------------------------------------------------
> Use CONNECT or CREATE DATABASE to specify a database--
> SQL> connect "c:\firebird\employee.fdb"
> CON> user 'sysdba'
> CON> password 'masterke';
> Database: "c:\firebird\employee.fdb", User: sysdba
> SQL> show tables;
> COUNTRY CUSTOMER
> DEPARTMENT EMPLOYEE
> EMPLOYEE_PROJECT JOB
> PHONE_LIST PROJECT
> PROJ_DEPT_BUDGET SALARY_HISTORY
> SALES
> SQL> create table T1 (P1 integer not null primary key);
> SQL> show tables;
> COUNTRY CUSTOMER
> DEPARTMENT EMPLOYEE
> EMPLOYEE_PROJECT JOB
> PHONE_LIST PROJECT
> PROJ_DEPT_BUDGET SALARY_HISTORY
> SALES T1
>
> SQL> create table T2 (F2 integer foreign key references T1.P1);
> Statement failed, SQLCODE = -104
>
> Dynamic SQL Error
> -SQL error code = -104
> -Token unknown - line 1, char 29
> -foreign
> SQL>
> --------------------------------------------------------------------------
>Yes. The right syntax, for example ;-)
> I don't get it. I doesn't know the token 'foreign' ... ?
> Does anyone have an idea about what's happening here ?
> Did I miss something ?
From the top of my head:
... REFERENCES T1 (P1)
Mind you, I hardly ever enter SQL ;-)
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