You can dismiss the complaint just as to you against any or all defendants. However, if there is a cross-complaint against you, that will continue unless you reach an agreement with the cross-complainant(s) to dismiss you. In addition, and this is really important, you must get any defendants who have appeared to agree, in writing, to waive any costs against you and bear their own attorneys fees.
Attorney Boyer is correct. Once you are out of the case, the other parties cannot propound discovery, but you could still be subpoenaed or have your documents subpoenaed.
Frank W. Chen has been licensed to practice law in California since 1988. The information presented here is general in nature and is not intended, nor should be construed, as legal advice for a particular case. This posting does not create any attorney-client relationship with the author. For specific advice about your particular situation, please consult with your own attorney.