Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute BEFOREINSERT trigger but then don't excute INSERT action

Status
Not open for further replies.

lasta

Programmer
Sep 27, 2003
10
UA
Please help me I am stuck.
I have got a table with information about workers. And I can not delete anyone from this table because it's records could be referenced from other tables.
So I that I want is to execute a BeforeInsert tirigger, check if user already exisits, and as a result execute INSERT command or don't execute it
 
Do you have defined the referential constraints in the Database? If so, delphi will not allow deletion. It would be better to look for a procedure to find all occurences of the record in the tables, and delete them in the right sequence.


Steven van Els
SAvanEls@cq-link.sr
 
Sorry for the confusion, I thaught it was the Delphi Forum


Use referential constraints (so called foreign keys) and apply rules:

An example, you have a table with products and you want to make a link to your suppliers table. Your supplier can go out of bussiness, change his name etc., but you don't want to lose your history because of that.

ALTER TABLE PRODUCTS
ADD FOREIGN KEY (SUPPLIER) REFERENCES SUPPLIERS
ON DELETE SET NULL
ON UPDATE CASCADE


Regards

Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top