Error using ON DELETE when adding a foreign key constraint

Error using ON DELETE when adding a foreign key constraint

Post by Dietrich L. Westbrook » Tue, 28 Aug 2001 07:08:13



Hello,

i am getting an error when i try to use the ON DELETE action when adding a
foriegn key constraint.

Syntax:
ALTER TABLE [table1] ADD CONSTRAINT [FK_FKYCASCADEDELETE]
FOREIGN KEY ([column1]) REFERENCES [table2] (column1)
ON DELETE CASCADE

Error:
Server: Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'ON'.

if i take out the 'ON DELETE CASCADE' it works fine. Need help?

Thanks!

Dietrich

 
 
 

Error using ON DELETE when adding a foreign key constraint

Post by Ivan Arjentinsk » Tue, 28 Aug 2001 07:12:26


Dietrich,

What version of SQL Server are you using?

--
Ivan Arjentinski
----------------------------------------------------------------------
You can deploy structural changes over production databases with the
SQL Schema Upgrade Wizard - www.aloeco.com/upgrader
----------------------------------------------------------------------


> Hello,

> i am getting an error when i try to use the ON DELETE action when adding a
> foriegn key constraint.

> Syntax:
> ALTER TABLE [table1] ADD CONSTRAINT [FK_FKYCASCADEDELETE]
> FOREIGN KEY ([column1]) REFERENCES [table2] (column1)
> ON DELETE CASCADE

> Error:
> Server: Msg 156, Level 15, State 1, Line 3
> Incorrect syntax near the keyword 'ON'.

> if i take out the 'ON DELETE CASCADE' it works fine. Need help?

> Thanks!

> Dietrich



 
 
 

Error using ON DELETE when adding a foreign key constraint

Post by Dietrich L. Westbrook » Tue, 28 Aug 2001 08:00:18


i am using SQL Server 7.0.


> Dietrich,

> What version of SQL Server are you using?

> --
> Ivan Arjentinski
> ----------------------------------------------------------------------
> You can deploy structural changes over production databases with the
> SQL Schema Upgrade Wizard - www.aloeco.com/upgrader
> ----------------------------------------------------------------------


> > Hello,

> > i am getting an error when i try to use the ON DELETE action when adding
a
> > foriegn key constraint.

> > Syntax:
> > ALTER TABLE [table1] ADD CONSTRAINT [FK_FKYCASCADEDELETE]
> > FOREIGN KEY ([column1]) REFERENCES [table2] (column1)
> > ON DELETE CASCADE

> > Error:
> > Server: Msg 156, Level 15, State 1, Line 3
> > Incorrect syntax near the keyword 'ON'.

> > if i take out the 'ON DELETE CASCADE' it works fine. Need help?

> > Thanks!

> > Dietrich


 
 
 

Error using ON DELETE when adding a foreign key constraint

Post by Umachandar Jayachandra » Tue, 28 Aug 2001 11:22:42


    You can't use cascading fk constraints in SQL70. This was introduced
only in SQL2000.

--
Umachandar Jayachandran
SQL Resources at http://www.umachandar.com/resources.htm
( Please reply only to newsgroup. )