Subject | Error creating table with foreign key |
---|---|
Author | Adrian Heesters |
Post date | 2005-10-05T01:14:39Z |
Hi,
I have installed fb1.5.2 on XP Home and have been trying to write some code
that creates a db.
I use Delphi 6 Pro for that and the Interbase components that come with it.
I got started just fine with the first table and then ran into problems when
creating a table with a foreign key.
The sql statement I was executing wasn't that different from the one in the
help file(s) I found (like Interbase SQL Reference - Create Table).
So I tried to execute the help-file statements through isql on the Employee db
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>
----------------------------------------------------------------------------
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 ?
Thanks in advance.
Adrian
[Non-text portions of this message have been removed]
I have installed fb1.5.2 on XP Home and have been trying to write some code
that creates a db.
I use Delphi 6 Pro for that and the Interbase components that come with it.
I got started just fine with the first table and then ran into problems when
creating a table with a foreign key.
The sql statement I was executing wasn't that different from the one in the
help file(s) I found (like Interbase SQL Reference - Create Table).
So I tried to execute the help-file statements through isql on the Employee db
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>
----------------------------------------------------------------------------
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 ?
Thanks in advance.
Adrian
[Non-text portions of this message have been removed]