Any application for emergency detainment, petition for commitment, application for commitment, order for a court-appointed examination, or written report to the circuit court must be sealed and may not be used for the purpose of enforcing the provisions of chapter 22-42 and chapter 22-42A against the person being committed. Any law enforcement official or prosecuting attorney may petition the circuit court to examine these documents, and the court may allow such examination upon a showing that the purpose of the examination is not to investigate a violation of chapter 22-42 or chapter 22-42A against the person being committed. Any information obtained from the examination of the application for emergency detainment, petition for commitment, application for commitment, order for a court-appointed examination, or written report to the circuit court may not be used against the person being committed in any prosecution for a violation of chapter 22-42 or chapter 22-42A.
SDCL 34-20A-70.2