> That leads to Cascading Delete & Update........
> It is not the Application problem..... It is part of the Schema Design.
> Oracle has this features for quite some time......... When MS is going to put
> this important features in ??????? SQL 8.0 or 9.0.....
> Samuel Wong
> > Your referencial integrity constrain says that every sales must point to a
> > vaild customer. So you can not remove a customer who has "outstanding"
> > sales. This is as it should be. Removing referencial integrity would work
> > but it will open a possibility for other applications to insert rows into
> > sales that do not point to a valid customer (during the period of time when
> > referencial integrity is off). Another solution is to write an sp, say,
> > specified customer and then remove the customer itself. This sp could then
> > be used by all applications that need to remove a customer. This has the
> > addtitional benefit that you do not have to give "delete" access to
> > customer and sales tables to your users. Execute on REMOVE_CUSTOMER is
> > enough.
> > On a philosophical plane this leads to another and broader question. What
> > should we use triggers for? Should we use them in order to give the
> > database means to defend itself or should we use them in order to do the
> > job that applications should do? I vote for the first one.
> > /Mikael
> > > Hi,
> > > I have two tables for example:
> > > 1. Customer
> > > 2. Sales
> > > Sales table has a foreign key that references customer. Now I ud like to
> > > delete all sales for the customer whenever a customer is deleted.
> > > Cascade delete is not yet supported by SQL Server 6.5. So I wrote
> > triggers
> > > in Customer to do the job. But I find that the before the delete trigger
> > on
> > > customer gets executed the referential intigrity rules (foreign key) gets
> > > applied and the delete fails giving a RI error that foreign key values
> > > exist on Sales.
> > > Well.... what to do? Can anybody help me?
> > > Now, I thought of something... how about deleting the referential
> > > intigrities. If I delete the foreign key relationships then I have to
> > > rewrite the triggers to do all the validations that are required for
> > > checking the foreign key values.
> > > Thanks in advance,
> > > Somnath
> > > --
> > > Quint Software Solutions
> > > EC-5, Sector 1, Salt Lake,
> > > Calcutta, INDIA. 700 064
> > > WWW: http://members.tripod.com/~quintsoftwares
> > > Ring: 91-33-3343538, 91-33-3581574
> > > Fax: 91-33-3581574
> > > * IBM Solution Developer
> > > * IBM Partner in Development
> > > * Microsoft Value Added Provider
SQL Anywhere (Sybase's low end product) has had it for several releases
also. I've had equal amounts of experience with SQL Server and SQL
Anywhere and find the MS product strong on GUI interfaces and tools for
people who don't know much about RDBMS's, but if you want to get serious
work done use the Sybase product.