Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

is it possible to create a nullifying cascade action in SQL Server 2000?

 

I mean, if I delete a row from a master table, the references to that row in a detail table are turned to NULL. I was thinking it was a standard feature in SQL, but in MS SQL I could not find anything else than ON DELETE CASCADE, which causes child row deletion.

 

Thanks

Ilya
  • *Experts*
Posted

I'm no DB Admin, but I don't think anything like that exists in SQL Server (null out the child table's FK). You could probably do it with triggers assuming the foreign key allowed nulls.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
I'm no DB Admin, but I don't think anything like that exists in SQL Server (null out the child table's FK). You could probably do it with triggers assuming the foreign key allowed nulls.

 

Thanks, I'm going to do it by triggers, though I will have to provide the referrential integrity by triggers too. I think that's very annoying feature of MS SQL that it does not support ON DELETE SET NULL and ON DELETE SET DEFAULT syntax.

Ilya

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...