Re: Cascade Delete On a Self referncing Table.

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Joe Celko (jcelko212_at_earthlink.net)
Date: 08/12/04


Date: Thu, 12 Aug 2004 10:42:33 -0700


>> I written a function which returns me the child nodes and with cursor
I delete the data from related tables. <<

Cursors? Don't you like using SQL? This is not a fix; it is a kludge
that will slow down and (unless you are very good about writing the
constraints) eventually fail as the volume grows.

I am willing to bet a virtual beer that you have nothing to prevent
cycles in your tree. You did not post DDL, so I do not know for
certain.

Here is the link on Amazon.com for my new book on "Trees & Hierarchies
in SQL"

http://www.amazon.com/exec/obidos/tg/detail/-/1558609202/qid=1080772873/
sr=1-1/ref=sr_1_1/102-7683601-6345721?v=glance&s=books#product-details

--CELKO--
 ===========================
 Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: get all rows that have status < 3
    ... Please post DDL, so that people do not have to guess what the keys, ... constraints, Declarative Referential Integrity, data types, etc. in ... You should never write a cursor when a query can do the job. ...
    (comp.databases.sybase)
  • Re: get all rows that have status < 3
    ... Please post DDL, so that people do not have to guess what the keys, ... constraints, Declarative Referential Integrity, data types, etc. in ... You should never write a cursor when a query can do the job. ...
    (comp.databases.sybase)
  • Re: Drag and drop between two tree controls
    ... You need to move the tree or expand the node on your own using a timer. ... You need to detect when the cursor is outside of the bounds of the tree and scroll the tree appropriately. ...
    (microsoft.public.vc.mfc)
  • Re: sum multiple record and inset in one table
    ... Did you mean concatenation? ... You will have to use a cursor to do the concantenation. ... Please post DDL, so that people do not have to guess what the keys, ...
    (microsoft.public.sqlserver.programming)
  • Re: Comprable technique to Yukons "WITH", in 2000?
    ... > I don't see how a cursor is a substitute for WITH in general. ... node-by-node, recursion was not necessary. ... placeholder value to produce a complete in-order representation of the tree. ... representations of the workflows, some of which had close to 100 levels.... ...
    (microsoft.public.sqlserver.programming)