I would start by reviewing the help doc here on transaction control, https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_transaction_control.htm. That outlines the use of the database savepoints and rollback, and if you have a specific issue with that, post it here.
--KC