Randomization and blinding
Eligible patients were randomly assigned to either a magnesium sulfate group or a normal (0.9%) saline group at a ratio of 1:1 using a computer-generated sequence. Group assignments were placed into opaque, sealed, consecutively numbered envelopes by staff who was not involved in the trial. The envelopes were opened just prior to ERCP by a certified registered anesthesia nurse who also prepared the drugs in coded syringes according to the order number indicating the group of assignment, and she/he was not associated with the management of patients and data collection and analyses. All patients, endoscopist, anesthetist, and data collector were blinded to the group assignment.