|
Posted by --CELKO-- on 12/16/05 15:32
>> Is there something wrong in the query? Or if someone can tell me a better approach. <<
The correct terms are "referenced" and "referencing" tables; "child"
and "parent" are terms from IDMS, IMS and other network DBMS systems.
It is always a dangerous thing to do queries and execture statements on
the schema information tables. It says that you do not know what you
are doing until run time.
Why not put DRI actions for ON DELETE CASCADE on the referencing tables
and let the system do the work properly so you do not have to do this
kind of manual housecleaning?
Why do you allow users to define tables on the fly in a production
database? That means you have no data model and users control the
schema, so you do not even know the names of your entities.
TRUNCATE is both proprietrary and dangerous (see what it does with
logging, its limitations, etc.)
The kludge to fix the bad design is to create DELETE FROM statements on
the fly. The real answer is to get a workable schema and to get rid of
this code.
Navigation:
[Reply to this message]
|