Morten,
In your extremely long mail, I think I managed to find your question and
removed all other stuff.
On Wed, Aug 13, 2003 at 03:18:26PM +0200, Morten Gulbrandsen wrote:
> mysql>
> mysql> # from now on the coding causes trouble
> mysql>
> mysql> ALTER TABLE EMPLOYEE
> -> FOREIGN KEY (SUPERSSN) REFERENCES EMPLOYEE(SSN)
> -> ON DELETE SET NULL
> -> ON UPDATE CASCADE;
> ERROR 1064: You have an error in your SQL syntax. Check the manual that
> corresp
> onds to your MySQL server version for the right syntax to use near
> 'FOREIGN KEY
> (SUPERSSN) REFERENCES EMPLOYEE(SSN)
> ON DELETE SET
> mysql>
6.5.4 ALTER TABLE Syntax
ALTER [IGNORE] TABLE tbl_name alter_specification [, alter_specification ...]
alter_specification:
ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
| ADD [COLUMN] (create_definition, create_definition,...)
| ADD INDEX [index_name] (index_col_name,...)
| ADD PRIMARY KEY (index_col_name,...)
| ADD UNIQUE [index_name] (index_col_name,...)
| ADD FULLTEXT [index_name] (index_col_name,...)
| ADD [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
[reference_definition]
| ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
| CHANGE [COLUMN] old_col_name create_definition
[FIRST | AFTER column_name]
| MODIFY [COLUMN] create_definition [FIRST | AFTER column_name]
| DROP [COLUMN] col_name
| DROP PRIMARY KEY
| DROP INDEX index_name
| DISABLE KEYS
| ENABLE KEYS
| RENAME [TO] new_tbl_name
| ORDER BY col
| table_options
So what it clearly tells you, is to use this (note the 'ADD'):
mysql> ALTER TABLE EMPLOYEE
-> ADD FOREIGN KEY (SUPERSSN) REFERENCES EMPLOYEE(SSN)
-> ON DELETE SET NULL
-> ON UPDATE CASCADE;
Regards,
Fred.
--
Fred van Engen XB Networks B.V.
email: [EMAIL PROTECTED] Televisieweg 2
tel: +31 36 5462400 1322 AC Almere
fax: +31 36 5462424 The Netherlands
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]