If you want to do it in the application level, use
]. Otherwise, you can create a stored procedure to perform these tasks which will return a value based on the success of the requested tasks. You can use
] within the SP for managing transactions.
For an example in SQL transactions click here
Hope this helps, regards