Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete in code or in trigger?
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01545281
Message ID:
01545284
Views:
53
>>>Hi,
>>>
>>>What is a better practice when deleting a record in a table (that has FKs), in code (VFP code) or with a trigger in SQL Server?
>>>
>>>TIA.
>>
>>In SSMS you can set relations to CASCADE deletes on FK records. I prefer that although I'm sure there are circumstances where that would be a bad thing.
>
>I did try to use CASCADE delete on FK but had a problem where SQL would not allow me to. I don't know if you remember that I had this issue that SQL refers to as "cause cycles or multiple cascade parts." So I had to remove all of my CASCADE delete. So now what remains is to either do it in code from VFP or in INSTEAD OF DELETE trigger. I am leaning towards the trigger since if I ever change my app to another platform (e.g. ASP.NET), the delete will be taken care of. But I wanted to hear what gurus have to say.
>
>Thank you.

In this case the trigger should do.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform