Home > Ask the SQL Server Experts > Questions & Answers > ON DELETE and ON UPDATE on same table
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

ON DELETE and ON UPDATE on same table

Rudy Limeback EXPERT RESPONSE FROM: Rudy Limeback

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 26 September 2004
I have two tables, AUTHOR and PC. I have declared the primary key of PC as foreign key in AUTHOR. When I tried to create the AUTHOR table with foreign key ON UPDATE CASCADE, I got the missing keyword error. When I used ON DELETE CASCADE, it creates the AUTHOR table. I want to know whether I can use both ON DELETE and ON UPDATE in one table? If so, why am I getting the problem for ON UPDATE? Could you please clarify this?

>

Whether you can use both ON DELETE and ON UPDATE will depend entirely on the database system you're using, and whether it supports those features.

We get a lot of questions submitted here, to the SQL Ask The Experts section of this site, by people who don't specify which database system they're using. That's as it should be, and most of the time my answer uses Structured Query Language that will work in any database system.

Sometimes, the questions are from people using Microsoft's SQL Server database, who either assume that SQL means SQL Server, or perhaps don't realize that there are separate SQL Server Ask The Experts sections. If I can, I will answer the question, even using SQL Server proprietary extensions to SQL if necessary.

But in your case, ON DELETE and ON UPDATE are standard SQL. So all I can say, based on the information you've given, is this: if you're using SQL Server, both ON DELETE and ON UPDATE are supported, so the problem is likely due to a syntax error on your part. If you're using some other database, I cannot help if I don't know what it is.

For More Information


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SQL Solutions - SQL Database Design
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts