Re: Tree table



Andrzej Jaworek wrote:

I have a "tree" table:

Id - primary key
ParrentId - (foreign key) related to Id
Title
.....

when I delete some record I want to delete it with all childs (cascade deleting). I can't set cascade deleting on the same table :(. Is there any easy way in the MSSQL 2005 to do this ? There is one idea - using cursors + recursive functions but I think this solution is not easy and elegant.

Another idea is to split ParentId off into a second table, but that's
probably even less easy and elegant.
.



Relevant Pages

  • Tree table
    ... Id - primary key ... ParrentId - (foreign key) related to Id ... I can't set cascade deleting on the same table:(. ...
    (comp.databases.ms-sqlserver)
  • Re: FAQ? factors influencing choice of data type for primary key
    ... >>example, an Autonumber as a primary key, are there ... >>it is a foreign key? ... >don't need to bring the lookup table or any indexes into ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Data changes but reverts.
    ... > trust my data to a wizard-built form. ... > 3) What is the primary and foreign key in your relationship ... I did a TABLEUPDATE() and it's now working! ... The symbol field is the primary key in the Symbols table and it is ...
    (microsoft.public.fox.programmer.exchange)
  • RE: Creating an DB for an Office Rota/Skills
    ... Also how do i set up a foreign key? ... primary key because atm i have to type them in eg. 1.2.3.4.5 for each persons ... "Duane Hookom" wrote: ... fields for skills and/or days then you are on your own. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Database Design Question
    ... > Using foreign keys to form a composite primary key of a child ... > LanguageId int identitynot null, ... If the foreign key does not lead the Primary Key, ...
    (microsoft.public.sqlserver.server)