all groups > sql server (alternate) > september 2004 >
You're in the

sql server (alternate)

group:

Problem with a foreing key


Problem with a foreing key Federica T
9/28/2004 3:41:22 PM
sql server (alternate):
I'm a beginner in using SQLServer and I 'm trying to bring a db Schema
written for DB2 into SQLServer.
My problem is this: using a tool to translate the script for creating the
DB, I obtain the following code:

ALTER TABLE PROJECT.RSURETTA ADD FOREIGN KEY(VOCE )
REFERENCES PROJECT.RSANVOCE(VOCE ) ON DELETE SET NULL ON UPDATE NO ACTION

But, when I try to run the script the system says:

Incorrect syntax near the keyword 'SET'.

Can I assign a null value to an other table with a reference?

Thank you
Fede

Re: Problem with a foreing key Simon Hayes
9/28/2004 4:05:00 PM

[quoted text, click to view]

No - SET NULL is not implemented in MSSQL 2000 (I think it will be in MSSQL
2005); the only options are NO ACTION or CASCADE. If you need this
functionality, then triggers would probably be the best way to go, or
perhaps a stored procedure which performs the DELETE and also sets the
values to NULL in the referencing table.

Simon

Re: Problem with a foreing key Federica T
9/28/2004 4:26:11 PM

"Simon Hayes" <sql@hayes.ch> ha scritto nel messaggio
news:41596f8d_2@news.bluewin.ch...
[quoted text, click to view]
Thank you!
Fede

AddThis Social Bookmark Button