Hi! Is there a way to delete a record from multiple tables at the same time? Thanks for the help!
hmm not totally sure what you mean
Are you referring to atomically? So like nothing happens in between deleting them? if that's the case you have to do it as a transaction
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.aspx
Is how you'd do it in code|||
Hi James25,
Is there a way to delete a record from multiple tables at the same time?
I would suggest you using triggers. You can create a trigger on one table and within that trigger defination, delete the corresponding records from other 5 tables.
For detailed information, please refer to this msdn document:http://msdn2.microsoft.com/en-us/library/ms189799.aspx
Hope my suggestion helps
|||Thanks! That's what I am gonna implement.
Cheers!
|||Thank you for the reply! Sorry, it took me a while to get back, I am gonna use a trigger for this problem.
|||k
but be really careful about using triggers too extensively
they typically violate the seperation of layers
since they cause logic to happen unbeknownest to your business logic layers
|||I'll keep that in mind. Thank you!
No comments:
Post a Comment